Module: ODDB::View::PartSize

Included in:
AdditionalInformation, Admin::SequencePackageList, Ajax::DDDChart, Drugs::CompositionList, Drugs::DDDPrice, Drugs::DDDPriceComposite, Drugs::Package
Defined in:
src/view/additional_information.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) comparable_size(model, session = @session)



11
12
13
14
15
16
17
18
19
20
# File 'src/view/additional_information.rb', line 11

def comparable_size(model, session=@session)
  comforms = model.commercial_forms
  unless(comforms.compact.empty?)
    model.parts.collect { |part|
      part_size part
    }.join(' + ')
  else
    model.size
  end
end

- (Object) part_size(part, session = @session)



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'src/view/additional_information.rb', line 21

def part_size(part, session=@session)
  parts = []
  multi = part.multi.to_i
  count = part.count.to_i
  if(multi > 1) 
    parts.push(multi)
  end
  if(multi > 1 && count > 1)
    parts.push('x')
  end
  if(count > 1 || (count > 0 && multi > 1))
    parts.push(part.count)
  end
  measure = part.measure
  measure = nil if measure == 1
  if(comform = part.commercial_form)
    parts.push(comform.send(@session.language))
    parts.push "à" if measure
  elsif(measure && !parts.empty?)
    parts.push('x')
  end
  parts.push measure if(measure)
  parts.join(' ')
end