Skip to content

Commit

Permalink
Fix float equal
Browse files Browse the repository at this point in the history
  • Loading branch information
hooopo committed May 20, 2021
1 parent cf1a001 commit d7d6743
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/score_calculator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def update_posts_score(opts)
SET p.score = x.score
SQL

builder.where("posts.score IS NULL OR posts.score <> #{components}", @weightings)
builder.where("posts.score IS NULL OR ABS(#{components} - posts.score) > 1e-5 ", @weightings)

filter_topics(builder, opts)

Expand Down Expand Up @@ -77,7 +77,7 @@ def update_posts_rank(opts)
SET posts.percent_rank = X.percent_rank
SQL

builder.where("posts.percent_rank IS NULL OR Y.percent_rank <> posts.percent_rank")
builder.where("posts.percent_rank IS NULL OR ABS(Y.percent_rank - posts.percent_rank) > 1e-5 ")

filter_topics(builder, opts)

Expand Down

0 comments on commit d7d6743

Please sign in to comment.