Skip to content

Commit

Permalink
Changed rounding of market share values
Browse files Browse the repository at this point in the history
  • Loading branch information
maricavor committed Sep 16, 2022
1 parent 440513f commit 9b3d1eb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/controllers/repp/v1/stats_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ def set_zero_values!(cur, prev)

def calculate_market_share(domains_by_rar)
sum = domains_by_rar.values.sum
domains_by_rar.transform_values { |v| (v.to_f / sum * 100.0).round(1) }
domains_by_rar.transform_values do |v|
value = v.to_f / sum * 100.0
value < 0.1 ? value.round(3) : value.round(1)
end
end
end
end
Expand Down

0 comments on commit 9b3d1eb

Please sign in to comment.