77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
# File 'lib/zcc/pickers.rb', line 77
def zcc_select_good_marc(take_how_many)
unless self[0].is_a? MARC::Record
raise ArgumentError, "This Array doesn't have a MARC::Record!" end
rec_copy = self.dup
rec_copy = rec_copy.sort_by {|rec| rec['245']['a']}
recs_to_return = []
loop {
print $clear_code
rec_copy.each_index do |index|
ZCC.(rec_copy, index)
puts "\n\n"
end
whichrec = ''
if take_how_many =='one'
whichrec = ask("\n<%= color('Enter # | s# | c#-# | l# | none :', UNDERLINE) %> ", String){ |q| q.readline = true }
else
whichrec = ask("\n<%= color('Enter # | n | s# | c#-# | l# | d :', UNDERLINE) %> ", String){ |q| q.readline = true }
end
first_bit = whichrec[0,1]
puts "whichrec is an Integer" if whichrec.is_a?(Integer)
see_num = whichrec[1,9].to_i
if first_bit == 's'
print $clear_code
print "\a"
say("#{ZCC.zcc_marc_str_bold(rec_copy[see_num].to_s, 'record')}")
ask("<%= color('Hit ENTER to continue...', :headline) %> ")
next
elsif first_bit == 'c'
say("<%= color('comparison:', :headline) %> ")
comparison = whichrec[1,99]
compare_nums = comparison.split('-')
rec_copy[compare_nums[0].to_i].compare_marc(rec_copy[compare_nums[1].to_i])
ask("<%= color('Hit ENTER to continue...', :headline) %> ")
next
elsif first_bit == 'l'
rec_copy[whichrec[1,99].to_i].linter
ask("<%= color('Hit ENTER to continue...', :headline) %> ")
next
elsif take_how_many == 'one'
if ( whichrec == 'none' )
puts "Since you cannot decide on a good record, please refer the book to a cataloger."
return "none"
elsif ( first_bit =~ /[a-z]/i or whichrec == '' )
ZCC.not_valid_value
next
else
if whichrec.to_i > (rec_copy.length - 1)
puts "Your number exceeds the number of records in your retrieved set."
next
else
return recs_to_return << rec_copy[whichrec.to_i]
end
end
elsif take_how_many == 'multi'
if whichrec == 'd'
puts "You will not search any more zservers!"
recs_to_return << "done"
elsif ( whichrec == 'n' or whichrec == '' )
puts "recs that will be returned #{recs_to_return.length}"
return recs_to_return
elsif whichrec[0,1] =~ /[a-z]/i
ZCC.not_valid_value
next
else
if whichrec.to_i > (rec_copy.length - 1)
puts "Your number exceeds the number of records in your retrieved set."
next
else
recs_to_return << rec_copy[whichrec.to_i]
next
end
end
else
puts "That's not a valid value take_how_many value to pass into select_good_marc!"
end
return recs_to_return
}
end
|