app/helpers/cornell_catalog_helper.rb
# Group holding items into circulating, interwebs and rare (sort rare last)
Group holding items into circulating, interwebs and rare (sort rare last)
Group holding items into circulating interwebs and rare ( sort rare last )
def group_holdings holdings
    holdings.inject({}) do |grouped, holding|
      grouped['Circulating'] = [] if grouped['Circulating'].nil?
      grouped['*Online'] = [] if grouped ['*Online'].nil?
      grouped['Rare'] = [] if grouped['Rare'].nil?
      if Location::aeon_eligible? holding['location_code']
        grouped['Rare'] << holding
      elsif holding['location_name'].include?('*Networked Resource')
        grouped['*Online'] << holding
      else
        grouped['Circulating'] << holding
      end
      grouped.select! { |group, items| items.present? }
      Hash[grouped.sort]
    end
  end
def group_holdings holdings holdings . inject ( { } ) do | grouped , holding | grouped [ 'Circulating' ] = [ ] if grouped [ 'Circulating' ] . nil? grouped [ '*Online' ] = [ ] if grouped [ '*Online' ] . nil? grouped [ 'Rare' ] = [ ] if grouped [ 'Rare' ] . nil? if Location :: aeon_eligible? holding [ 'location_code' ] grouped [ 'Rare' ] << holding elsif holding [ 'location_name' ] . include? ( '*Networked Resource' ) grouped [ '*Online' ] << holding else grouped [ 'Circulating' ] << holding end grouped . select! { | group , items | items . present? } Hash [ grouped . sort ] end end
Group holding items into circulating, interwebs and rare (sort rare last)
Group holding items into circulating interwebs and rare ( sort rare last )
#if holding['location_code'].include?('rmc') ##Rails.logger.debug "\nes287_debug file:#{__FILE__} line:#{__LINE__}  holding = #{holding.pretty_inspect}" # Remove empty groups (no holdings) # Sort groups by key so rare is last & *online is first
holdings
<not_specific>