Skip to content

Commit

Permalink
fix: cast the final value to keep the scale
Browse files Browse the repository at this point in the history
  • Loading branch information
wbotelhos committed Jan 25, 2024
1 parent 72de00b commit e8582b7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rating/models/rating/rating.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def averager_data(resource, scopeable)

sql = %(
SELECT
CAST(#{total_count} AS DECIMAL(25, 16) / #{distinct_count}) count_avg,
CAST(#{total_count} / #{distinct_count} AS DECIMAL(25, 16)) count_avg,
COALESCE(AVG(value), 0) rating_avg
FROM #{rate_table_name}
WHERE
Expand Down

0 comments on commit e8582b7

Please sign in to comment.