mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-23 20:18:00 +01:00
Update to streamline Wilson score generation (#10)
* Update to streamline Wilson score generation If an image's `upvotes` are 0, their Wilson score will be so minuscule as to be several (around 12) orders of magnitude before you see anything but zeros (assuming 0 `upvotes` and 1 `downvotes`). This will simply remove the calculation from such and make them fall to the default: 0 * Update elasticsearch_index.ex Co-authored-by: liamwhite <liamwhite@users.noreply.github.com>
This commit is contained in:
parent
dd84e8631b
commit
68c3d035b3
1 changed files with 1 additions and 2 deletions
|
@ -143,8 +143,7 @@ defmodule Philomena.Images.ElasticsearchIndex do
|
|||
}
|
||||
end
|
||||
|
||||
def wilson_score(%{upvotes_count: upvotes, downvotes_count: downvotes})
|
||||
when upvotes > 0 or downvotes > 0 do
|
||||
def wilson_score(%{upvotes_count: upvotes, downvotes_count: downvotes}) when upvotes > 0 do
|
||||
# Population size
|
||||
n = (upvotes + downvotes) / 1
|
||||
|
||||
|
|
Loading…
Reference in a new issue