Class: ODDB::State::Ajax::DDDChart

Inherits:
Global show all
Defined in:
src/state/ajax/ddd_chart.rb

Constant Summary

VIEW =
View::Ajax::DDDChart

Constants inherited from Global

VOLATILE

Instance Method Summary (collapse)

Methods inherited from Global

#limited?

Instance Method Details

- (Object) init



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'src/state/ajax/ddd_chart.rb', line 12

def init
  super
  img_name = @session.user_input(:for)
  match = /^(\d{5})(\d{3})/.match img_name
  original = @session.registration(match[1]).package(match[2])
  packages = original.generic_group_comparables
  packages.concat original.sequence.public_packages
  [0.5, 2, 1].each do |factor|
    original.sequence.comparables(factor).each do |seq|
      packages.concat seq.public_packages
    end
  end
  packages.uniq!
  @model = packages.select do |pac| pac.ddd_price end.sort_by do |pac|
    [ pac.name_base, pac.size ]
  end
end