Skip to content

Commit

Permalink
fix divide by zero if stddev is <1
Browse files Browse the repository at this point in the history
  • Loading branch information
pushcx committed Jan 2, 2024
1 parent 4fd296e commit 4c01d77
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/models/flagged_commenters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ def aggregates
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
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>
Expand Down

0 comments on commit 4c01d77

Please sign in to comment.