diff --git a/lib/rating/models/rating/rating.rb b/lib/rating/models/rating/rating.rb index 52e8670..e955103 100644 --- a/lib/rating/models/rating/rating.rb +++ b/lib/rating/models/rating/rating.rb @@ -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