Module: SpreeCmCommissioner::Admin::VideoOnDemandHelper
- Included in:
- VideoOnDemand
- Defined in:
- app/helpers/spree_cm_commissioner/admin/video_on_demand_helper.rb
Instance Method Summary collapse
Instance Method Details
#calculate_protocol_value(params) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'app/helpers/spree_cm_commissioner/admin/video_on_demand_helper.rb', line 13 def calculate_protocol_value(params) protocol_params = params.slice(*SpreeCmCommissioner::VideoOnDemandBitwise::PROTOCOL_BIT_FIELDS.keys) return nil unless protocol_params.values.any?(&:present?) protocol_params.values.each_with_index.sum do |value, index| value.to_i * (2**index) end end |
#calculate_quality_value(params) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'app/helpers/spree_cm_commissioner/admin/video_on_demand_helper.rb', line 4 def calculate_quality_value(params) quality_params = params.slice(*SpreeCmCommissioner::VideoOnDemandBitwise::QUALITY_BIT_FIELDS.keys) return nil unless quality_params.values.any?(&:present?) quality_params.values.each_with_index.sum do |value, index| value.to_i * (2**index) end end |