Method: CustomTable::ApplicationHelper#custom_table_fields_totals
- Defined in:
- app/helpers/custom_table/application_helper.rb
#custom_table_fields_totals(fields:, totals:, item:, fields_totals:, variant:) ⇒ Object
470 471 472 473 474 475 476 477 478 |
# File 'app/helpers/custom_table/application_helper.rb', line 470 def custom_table_fields_totals fields:, totals:, item:, fields_totals:, variant: fields.each do |field, defs| if !totals.nil? && totals.has_key?(field) && totals[field].nil? # Auto-counting fields_totals[field] = 0 if fields_totals[field].nil? fields_totals[field] += raw_field_value_for(item, field, definitions: defs, variant: variant).to_f rescue 0 end end return fields_totals end |