Class: ODDB::State::Drugs::Compare

Inherits:
Global show all
Defined in:
src/state/drugs/compare.rb,
test/test_model/comparison.rb

Defined Under Namespace

Classes: Comparison

Constant Summary

VIEW =
View::Drugs::Compare
LIMITED =
true

Constants inherited from Global

HOME_STATE, ZONE, ZONE_NAVIGATION

Constants inherited from Global

DIRECT_EVENT, GLOBAL_MAP, HOME_STATE, LIMITED, PRINT_STATES, READONLY_STATES, RESOLVE_STATES, REVERSE_MAP, VIEW, ZONE_NAVIGATION

Constants included from UmlautSort

FILTER_PAIRS

Instance Method Summary (collapse)

Methods inherited from Global

#limit_state

Methods inherited from Global

#_search_drugs, #_search_drugs_state, #_trigger, #add_to_interaction_basket, #allowed?, #atc_chooser, #checkout, #clear_interaction_basket, #creditable?, #direct_request_path, #doctorlist, #download, #export_csv, #extend, #fachinfo, #feedbacks, #help_navigation, #home_navigation, #home_state, #hospitallist, #interaction_basket, #limit_state, #limited?, #logout, #navigation, #notify, #password_reset, #paypal_return, #powerlink, #print, #proceed_download, #proceed_poweruser, #resolve, #resolve_state, #rss, #search, #show, #snapback_event, #sort, #sponsorlink, #suggest_address, #switch, #unique_email, #user_input, #user_navigation, #ywesee_contact, #zone_navigation, #zones

Methods included from Admin::LoginMethods

#autologin, #login

Methods included from UmlautSort

#sort_model, #umlaut_filter

Instance Method Details

- (Object) init



73
74
75
76
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
# File 'src/state/drugs/compare.rb', line 73

def init
  @model = nil
  if (pointer = @session.user_input(:pointer)) \
    && pointer.is_a?(Persistence::Pointer)
    @package = pointer.resolve(@session.app)
  elsif ean13 = @session.user_input(:ean13)
    @package = @session.app.package_by_ikskey(ean13.to_s[4,8])
  elsif term = @session.user_input(:search_query)
    @package = ODDB::Package.find_by_name_with_size term
  end
  if @package.is_a?(ODDB::Package)
    begin
      @model = Comparison.new(@package)
      descr = @session.lookandfeel.lookup(:compare_descr,
        @package.name_base)
      @model.pointer_descr = descr
    rescue StandardError => e
      puts e.class
      puts e.message
      puts e.backtrace
    end
  end
  if(@model.nil?)
    @default_view = View::Http404
  elsif(@model.atc_class.nil?)
    @default_view = View::Drugs::EmptyCompare
  else
    @default_view = View::Drugs::Compare
  end
rescue Persistence::UninitializedPathError
  @default_view = View::Http404
end