Module: ODDB::Html::Util::PackageSort
- Includes:
- Sort
- Included in:
- State::Drugs::Compare, State::Drugs::Result
- Defined in:
- lib/oddb/html/util/sort.rb
Instance Method Summary collapse
Methods included from Sort
#_sort, #_sort_by, #sort, #sort_by
Instance Method Details
#sort_proc(key) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/oddb/html/util/sort.rb', line 39 def sort_proc(key) case key when :company Proc.new { |pac| (multilingual = pac.send(key)) \ && multilingual.name.send(@session.language) || '' } when :ddd_prices Proc.new { |pac| pac.ddds.collect { |ddd| pac.dose_price(ddd.dose) }.compact } when :difference nilval = 9999999.0 Proc.new { |pac| pac.difference || nilval } when :package_infos Proc.new { |pac| [ pac.code(:festbetragsgruppe).to_s, pac.code(:festbetragsstufe).to_s, pac.code(:prescription).to_s, pac.code(:zuzahlunggsbefreit).to_s, ] } when :price_public, :price_festbetrag nilval = ODDB::Util::Money.new(0) key = key.to_s.sub(/^price_/, '').to_sym Proc.new { |pac| pac.price(key) || nilval } when :product Proc.new { |pac| pac.name.send(@session.language) \ || ((prod = pac.product) && prod.name.send(@session.language)) || '' } end end |