Class: TranslationCms::Api::Rates::Commission

Inherits:
Base
  • Object
show all
Extended by:
EnumField::EnumeratedAttribute
Defined in:
lib/translation_cms/api/rates/commission.rb

Instance Method Summary collapse

Methods inherited from Base

all!, custom_scope!, default_attributes, destroy, dummy_resource!, #method_missing_with_translations_will_change, parsed!, path_with_custom_scope, resource_type!, update

Instance Method Details

#checkpointObject



18
19
20
21
22
23
24
25
26
27
# File 'lib/translation_cms/api/rates/commission.rb', line 18

def checkpoint
  c_from = commission_type.orders_total? ? checkpoint_from.to_f.round(2) : checkpoint_from.to_i
  c_to = commission_type.orders_total? ? checkpoint_to.to_f.round(2) : checkpoint_to.to_i
  c_from = 0 if c_from < 0
  if c_to <= 0
    "#{c_from}+"
  else
    "#{c_from} - #{c_to}"
  end
end