app/helpers/cornell_catalog_helper.rb
# given hlding records, and condensed info
#  and items, create a list of temp_locations that shows the (possibly temporary)
#  library location that is to displayed as part of the holding display
given hlding records, and condensed info
and items, create a list of temp_locations that shows the (possibly temporary)
library location that is to displayed as part of the holding display
given hlding records and condensed info and items create a list of temp_locations that shows the ( possibly temporary ) library location that is to displayed as part of the holding display
def parse_over_info(hrds,condensed,items,locnames_by_lid)
	    over = {}
	    overinfo = {}
	    ocnt = {} 
	    total = {} 
	    items.each do |iinfo|
	      tmploc = {}
	      mid = iinfo['mfhd_id']
	      next if hrds[mid].nil?
	      Rails.logger.debug "\nes287_debug hrds  file:{__FILE__} line:({__LINE__}) location id = " + hrds[mid]["locations"][0]["number"].to_s
	      lid   =  hrds[mid]["locations"][0]["number"].to_s
	      Rails.logger.debug "\nes287_debug item file:{__FILE__} line:({__LINE__}) mid = " + mid.inspect
	      Rails.logger.debug "\nes287_debug class of permlocation file:{__FILE__} line:({__LINE__}) class = " + iinfo[:perm_location].class.to_s
	      dispname = ""
	      dcode = " "
	      if iinfo[:perm_location].class == ActiveSupport::HashWithIndifferentAccess
		dcode = iinfo[:perm_location][:number].to_s
		dispname = iinfo[:perm_location][:name]
	      else
		if !iinfo["perm_location"].blank?
		  dcode = iinfo["perm_location"]
		  Rails.logger.debug "\nes287_debug class of permlocation file:{__FILE__} line:({__LINE__}) dcode = " + dcode.inspect
		  dispname = locnames_by_lid[dcode][:display_name] unless dcode.blank?
		end
	      end
	      Rails.logger.debug "\nes287_debug dcode file:{__FILE__} line:({__LINE__}) dcode = " + dcode.inspect
	      if dcode != " " &&   dcode != hrds[mid]["locations"][0]["number"].to_s
	       if iinfo['perm_location'] != hrds[mid]["locations"][0]["number"].to_s
		Rails.logger.debug "\nes287_debug item  file:{__FILE__} line:({__LINE__}) OVERRIDDEN  by item perm location = " + iinfo['perm_location'].inspect
		Rails.logger.debug "\nes287_debug locnames by lid file:{__FILE__}  line:({__LINE__}) = " + locnames_by_lid.inspect
		ocnt[lid]  =  ocnt[lid].blank? ?  1 : ocnt[lid]+1
		total[lid]  =  total[lid].blank? ?  1 : total[lid]+1
		Rails.logger.debug "\nes287_debug ocnt line:({__LINE__}) overridden count = " + ocnt.inspect
		tmploc["location_name"] = dispname
		dcode = iinfo[:perm_location][:number].to_s
		tmploc["location_code"] = dcode
		tmploc["item_enum"] = iinfo[:item_enum]
		tmploc["holding_id"] = [mid]
		tmploc["chron"] = iinfo[:chron]
		tmploc["call_number"] = hrds[mid]["callnos"][0]
		tmploc["copies"] = iinfo[:copy_number]
		copies = ""
		copies = " c. {tmploc['copies']} " unless tmploc.blank?
		Rails.logger.debug "\nes287_debug {__FILE__}:{__LINE__} tmploc = " + tmploc.inspect
		tmploc["display"] = Maybe(tmploc['item_enum']) + ' ' + Maybe(tmploc['chron']) + Maybe(copies) +  " Shelved in {dispname}"
		oneloc["summary_holdings"] = "Library has: " + summary_holdings.join(' ') unless summary_holdings.blank?
		Rails.logger.debug "\nes287_debug line({__LINE__}) item = " + iinfo.inspect
		Rails.logger.debug "\nes287_debug line({__LINE__}) tmploc = " + tmploc.inspect
		Rails.logger.debug "\nes287_debug file:{__FILE__} line({__LINE__}) dispname = " + dispname.inspect
		overinfo[mid]  =   tmploc
		if over[mid].blank?
		   over[mid]  =  [ tmploc["display"] ]
		else
		  over[mid] << tmploc["display"]
		 end
	      end
	      if (!iinfo['temp_location'].blank? && iinfo['temp_location'] != "0"  ) && iinfo['temp_location'] != hrds[mid]["locations"][0]["number"].to_s
		Rails.logger.debug "\nes287_debug item line:({__LINE__} OVERRIDDEN  item temp location = " + iinfo['temp_location'].inspect
		dispname = locnames_by_lid[iinfo[:temp_location]][:display_name]
		ocnt[lid]  =  ocnt[lid].blank? ?  1 : ocnt[lid]+1
		total[lid]  =  total[lid].blank? ?  1 : total[lid]+1
		Rails.logger.debug "\nes287_debug ocnt line:({__LINE__}) overriden count = " + ocnt.inspect
		tmploc["location_name"] = dispname
		dcode = locnames_by_lid[iinfo[:temp_location]][:location_code]
		tmploc["location_code"] = dcode
		tmploc["holding_id"] = [mid]
		tmploc["item_enum"] = iinfo[:item_enum]
		tmploc["chron"] = iinfo[:chron]
		tmploc["call_number"] = hrds[mid]["callnos"][0]
		tmploc["copies"] = []
		tmploc["display"] = tmploc['item_enum'] +  ' ' + tmploc['chron'] + " Temporarily shelved in {dispname}"
		Rails.logger.debug "\nes287_debug line({__LINE__}) tmploc = " + tmploc.inspect
		Rails.logger.debug "\nes287_debug line({__LINE__}) dispname = " + dispname
		overinfo[mid]  =   tmploc
		if over[mid].blank?
		   over[mid]  =  [ tmploc["display"] ]
		else
		  over[mid] <<  tmploc["display"]
		 end
	      end
	    end
	    Rails.logger.debug "\nes287_debug ocnt line:({__LINE__}) overridden count = " + ocnt.inspect
	    Rails.logger.debug "\nes287_debug total line:({__LINE__}) item count in holding = " + total.inspect
	    return over,overinfo
	  end
def parse_over_info ( hrds , condensed , items , locnames_by_lid ) over = { } overinfo = { } ocnt = { } total = { } items . each do | iinfo | tmploc = { } mid = iinfo [ 'mfhd_id' ] next if hrds [ mid ] . nil? lid = hrds [ mid ] [ "locations" ] [ 0 ] [ "number" ] . to_s dispname = "" dcode = " " if iinfo [ :perm_location ] . class == ActiveSupport :: HashWithIndifferentAccess dcode = iinfo [ :perm_location ] [ :number ] . to_s dispname = iinfo [ :perm_location ] [ :name ] else if ! iinfo [ "perm_location" ] . blank? dcode = iinfo [ "perm_location" ] dispname = locnames_by_lid [ dcode ] [ :display_name ] unless dcode . blank? end end if dcode != " " && dcode != hrds [ mid ] [ "locations" ] [ 0 ] [ "number" ] . to_s ocnt [ lid ] = ocnt [ lid ] . blank? ? 1 : ocnt [ lid ] + 1 total [ lid ] = total [ lid ] . blank? ? 1 : total [ lid ] + 1 tmploc [ "location_name" ] = dispname tmploc [ "location_code" ] = dcode tmploc [ "item_enum" ] = iinfo [ :item_enum ] tmploc [ "holding_id" ] = [ mid ] tmploc [ "chron" ] = iinfo [ :chron ] tmploc [ "call_number" ] = hrds [ mid ] [ "callnos" ] [ 0 ] tmploc [ "copies" ] = iinfo [ :copy_number ] copies = "" copies = " c. #{tmploc['copies']} " unless tmploc . blank? tmploc [ "display" ] = Maybe ( tmploc [ 'item_enum' ] ) + ' ' + Maybe ( tmploc [ 'chron' ] ) + Maybe ( copies ) + " Shelved in #{dispname}" overinfo [ mid ] = tmploc if over [ mid ] . blank? over [ mid ] = [ tmploc [ "display" ] ] else over [ mid ] << tmploc [ "display" ] end end if ( ! iinfo [ 'temp_location' ] . blank? && iinfo [ 'temp_location' ] != "0" ) && iinfo [ 'temp_location' ] != hrds [ mid ] [ "locations" ] [ 0 ] [ "number" ] . to_s dispname = locnames_by_lid [ iinfo [ :temp_location ] ] [ :display_name ] ocnt [ lid ] = ocnt [ lid ] . blank? ? 1 : ocnt [ lid ] + 1 total [ lid ] = total [ lid ] . blank? ? 1 : total [ lid ] + 1 tmploc [ "location_name" ] = dispname dcode = locnames_by_lid [ iinfo [ :temp_location ] ] [ :location_code ] tmploc [ "location_code" ] = dcode tmploc [ "holding_id" ] = [ mid ] tmploc [ "item_enum" ] = iinfo [ :item_enum ] tmploc [ "chron" ] = iinfo [ :chron ] tmploc [ "call_number" ] = hrds [ mid ] [ "callnos" ] [ 0 ] tmploc [ "copies" ] = [ ] tmploc [ "display" ] = tmploc [ 'item_enum' ] + ' ' + tmploc [ 'chron' ] + " Temporarily shelved in #{dispname}" overinfo [ mid ] = tmploc if over [ mid ] . blank? over [ mid ] = [ tmploc [ "display" ] ] else over [ mid ] << tmploc [ "display" ] end end end return over , overinfo end
given hlding records, and condensed info
and items, create a list of temp_locations that shows the (possibly temporary)
library location that is to displayed as part of the holding display
given hlding records and condensed info and items create a list of temp_locations that shows the ( possibly temporary ) library location that is to displayed as part of the holding display
# how many items have an over ridden location, either temp OR perm, indexed by  number # how many items are in a location ##Rails.logger.debug "\nes287_debug saved response  file:#{__FILE__} line:(#{__LINE__}) @response= " + @response.inspect ##Rails.logger.debug "\nes287_debug all holdings records from document  file:#{__FILE__} line:(#{__LINE__}) hrds= " + hrds.inspect ##Rails.logger.debug "\nes287_debug locnames by lid document  file:#{__FILE__} line:(#{__LINE__}) locnames by lid= " + locnames_by_lid.inspect ##Rails.logger.debug "\nes287_debug number of items  file:#{__FILE__} line:(#{__LINE__})= " + items.size.to_s ##Rails.logger.debug "\nes287_debug item  file:#{__FILE__} line:(#{__LINE__}) iinfo= " + iinfo.inspect ##Rails.logger.debug "\nes287_debug item  file:#{__FILE__} line:(#{__LINE__}) hrds[mid]= " + hrds[mid].inspect # ##Rails.logger.debug "\nes287_debug hrds  file:#{__FILE__} line:(#{__LINE__}) location id = " + hrds[mid]["locations"][0]["number"].to_s ##Rails.logger.debug "\nes287_debug item file:#{__FILE__} line:(#{__LINE__}) mid = " + mid.inspect ##Rails.logger.debug "\nes287_debug class of permlocation file:#{__FILE__} line:(#{__LINE__}) class = " + iinfo[:perm_location].class.to_s ##Rails.logger.debug "\nes287_debug class of permlocation file:#{__FILE__} line:(#{__LINE__}) dcode = " + dcode.inspect ##Rails.logger.debug "\nes287_debug dcode file:#{__FILE__} line:(#{__LINE__}) dcode = " + dcode.inspect # if iinfo['perm_location'] != hrds[mid]["locations"][0]["number"].to_s ##Rails.logger.debug "\nes287_debug item  file:#{__FILE__} line:(#{__LINE__}) OVERRIDDEN  by item perm location = " + iinfo['perm_location'].inspect ##Rails.logger.debug "\nes287_debug locnames by lid file:#{__FILE__}  line:(#{__LINE__}) = " + locnames_by_lid.inspect ##Rails.logger.debug "\nes287_debug ocnt line:(#{__LINE__}) overridden count = " + ocnt.inspect #dcode = iinfo[:perm_location][:number].to_s ##Rails.logger.debug "\nes287_debug #{__FILE__}:#{__LINE__} tmploc = " + tmploc.inspect #oneloc["summary_holdings"] = "Library has: " + summary_holdings.join(' ') unless summary_holdings.blank? ##Rails.logger.debug "\nes287_debug line(#{__LINE__}) item = " + iinfo.inspect ##Rails.logger.debug "\nes287_debug line(#{__LINE__}) tmploc = " + tmploc.inspect ##Rails.logger.debug "\nes287_debug file:#{__FILE__} line(#{__LINE__}) dispname = " + dispname.inspect ##Rails.logger.debug "\nes287_debug item line:(#{__LINE__} OVERRIDDEN  item temp location = " + iinfo['temp_location'].inspect ##Rails.logger.debug "\nes287_debug ocnt line:(#{__LINE__}) overriden count = " + ocnt.inspect ##Rails.logger.debug "\nes287_debug line(#{__LINE__}) tmploc = " + tmploc.inspect ##Rails.logger.debug "\nes287_debug line(#{__LINE__}) dispname = " + dispname ##Rails.logger.debug "\nes287_debug ocnt line:(#{__LINE__}) overridden count = " + ocnt.inspect ##Rails.logger.debug "\nes287_debug total line:(#{__LINE__}) item count in holding = " + total.inspect
hrds
<not_specific>
condensed
<not_specific>
items
<not_specific>
locnames_by_lid
<not_specific>