app/helpers/cornell_catalog_helper.rb
# make substitutions into status string.
make substitutions into status string.
make substitutions into status string .
def make_substitute(holding,items_solr)
	    status_text = ''
	    enum =  reqs = ''
	    date = sdate = ''
	    enum = copy = ''
	    if !holding[:ITEM_ID].nil?
	      sdate = holding[:ITEM_STATUS_DATE].to_s.slice(0,10)
	      date = holding[:CURRENT_DUE_DATE].blank? ? holding[:ITEM_STATUS_DATE].to_s.slice(0,10)  : holding[:CURRENT_DUE_DATE].to_s.slice(0,10)
	      solri = items_solr[holding[:ITEM_ID].to_s]
	      reqs = "0"
	      if !solri.nil?
	      copy = solri['copy_number'].blank? ? "" : " c. #{solri['copy_number']}"
		if  solri['item_enum'].blank?
		  enum = "#{holding[:ITEM_ENUM]}  #{holding[:CHRON]} #{copy}"
		else
		  enum = solri['item_enum'] + ' ' + solri['chron']+copy
		end
		reqs = solri['reqs'] ? solri['reqs'] : ''
	      end
	      norr = (reqs == '0' || reqs == '' ) ? 'n' : 'r'
	      status =  ITEM_STATUS_CODES[holding[:ITEM_STATUS].to_s + norr].nil?  ?  "Status #{holding[:ITEM_STATUS].to_s} " : ITEM_STATUS_CODES[holding[:ITEM_STATUS].to_s + norr]['short_message']
	      status_text =  status.gsub('%ENUM',enum)
	      status_text =  status_text.gsub('%SDATE',sdate)
	      status_text =  status_text.gsub('%DATE',date)
	      status_text =  status_text.gsub('%REQS',reqs)
	      status_text =  status_text.gsub('at %LOC','') 
	      status_text =  status_text.gsub('to %LOC','') 
	    end
	  status_text
	  end
def make_substitute ( holding , items_solr ) status_text = '' enum = reqs = '' date = sdate = '' enum = copy = '' if ! holding [ :ITEM_ID ] . nil? sdate = holding [ :ITEM_STATUS_DATE ] . to_s . slice ( 0 , 10 ) date = holding [ :CURRENT_DUE_DATE ] . blank? ? holding [ :ITEM_STATUS_DATE ] . to_s . slice ( 0 , 10 ) : holding [ :CURRENT_DUE_DATE ] . to_s . slice ( 0 , 10 ) solri = items_solr [ holding [ :ITEM_ID ] . to_s ] reqs = "0" if ! solri . nil? copy = solri [ 'copy_number' ] . blank? ? "" : " c. #{solri['copy_number']}" if solri [ 'item_enum' ] . blank? enum = "#{holding[:ITEM_ENUM]}  #{holding[:CHRON]} #{copy}" else enum = solri [ 'item_enum' ] + ' ' + solri [ 'chron' ] + copy end reqs = solri [ 'reqs' ] ? solri [ 'reqs' ] : '' end norr = ( reqs == '0' || reqs == '' ) ? 'n' : 'r' status = ITEM_STATUS_CODES [ holding [ :ITEM_STATUS ] . to_s + norr ] . nil? ? "Status #{holding[:ITEM_STATUS].to_s} " : ITEM_STATUS_CODES [ holding [ :ITEM_STATUS ] . to_s + norr ] [ 'short_message' ] status_text = status . gsub ( '%ENUM' , enum ) status_text = status_text . gsub ( '%SDATE' , sdate ) status_text = status_text . gsub ( '%DATE' , date ) status_text = status_text . gsub ( '%REQS' , reqs ) status_text = status_text . gsub ( 'at %LOC' , '' ) status_text = status_text . gsub ( 'to %LOC' , '' ) end status_text end
make substitutions into status string.
make substitutions into status string .
#binding.pry ##Rails.logger.debug "es287_debug #{__FILE__} #{__LINE__} solri = #{solri.inspect}\n" #copy = solri['copy_number'].blank? ? "" : " c. #{solri['copy_number']}" ##Rails.logger.debug "es287_debug #{__FILE__} #{__LINE__} solri = #{solri.inspect}\n" ##Rails.logger.debug "es287_debug #{__FILE__} #{__LINE__} enum = #{enum.inspect}\n" ##Rails.logger.debug "es287_debug #{__FILE__} #{__LINE__} solri = #{solri.inspect}\n" ##Rails.logger.debug "es287_debug #{__FILE__} #{__LINE__} enum = #{enum.inspect}\n" ##Rails.logger.debug "es287_debug #{__FILE__} #{__LINE__} solri = #{solri.inspect}\n" ##Rails.logger.debug "es287_debug #{__FILE__} #{__LINE__} enum = #{enum.inspect}\n" #norr = reqs.empty? ? 'n' : 'r' ##Rails.logger.debug "es287_debug #{__FILE__}:#{__LINE__} status = #{status.inspect}\n" ##Rails.logger.debug "es287_debug #{__FILE__}:#{__LINE__} enum = #{enum.inspect}\n" ##Rails.logger.debug "es287_debug #{__FILE__}:#{__LINE__} reqs = #{reqs.inspect}\n" # I have not figured out where to get the loc from yet. # I have not figured out where to get the loc from yet. ##Rails.logger.debug "es287_debug #{__FILE__} #{__LINE__} status text = #{status_text.inspect}\n"
holding
<not_specific>
items_solr
<not_specific>