Skip to content

Commit

Permalink
Fix totals
Browse files Browse the repository at this point in the history
  • Loading branch information
gryphon committed May 2, 2024
1 parent a19dc28 commit 62881bd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/helpers/custom_table/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ def custom_table_totals collection, fields, totals = {}, fields_totals = {}
# We can try to sum value from database

if fields[field][:total_scope].nil?
out[field] = collection.except(:limit, :offset, :order, :group).sum(field)
else
out[field] = collection.except(:limit, :offset, :order, :group).send(fields[field][:total_scope])
out[field] = collection.except(:limit, :offset, :order, :group).distinct(false).sum(field)
else
out[field] = collection.except(:limit, :offset, :order, :group).distinct(false).send(fields[field][:total_scope])
end
else
# Taking simple summed value because all data is shown
Expand Down

0 comments on commit 62881bd

Please sign in to comment.