fix divide by zero if stddev is <1

This commit is contained in:
Peter Bhat Harkins 2024-01-02 12:35:25 -06:00
parent 4fd296e508
commit 4c01d77714
2 changed files with 3 additions and 3 deletions

View File

@ -45,11 +45,11 @@ class FlaggedCommenters
end
def stddev_sum_flags
aggregates[:stddev].to_i
aggregates[:stddev].to_f
end
def avg_sum_flags
aggregates[:avg].to_i
aggregates[:avg].to_f
end
def commenters

View File

@ -171,7 +171,7 @@
<label class="required">Flagged (1m):</label>
<span class="d">
<% if (stats = FlaggedCommenters.new('1m').check_list_for(@showing_user)) %>
<a href="/mod/commenters/1m#<%= @showing_user.username %>">#<%= stats[:rank] %></a> at <%= '%.2f' % stats[:sigma] %> &sigma;
<a href="/mod/commenters/1m#<%= @showing_user.username %>">#<%= stats[:rank] %></a> at <%= '%.2f' % (stats[:sigma] || 0) %> &sigma;
<% else %>
No
<% end %>