diff --git a/lib/score_calculator.rb b/lib/score_calculator.rb index 52a5c0116..2ca6e3eda 100644 --- a/lib/score_calculator.rb +++ b/lib/score_calculator.rb @@ -6,7 +6,7 @@ module ScoreCalculator period = [1, [max_period, resource_age(resource)].min].max votes_total = resource.votes_for.where("created_at >= ?", period.days.ago).count - votes_up = resource.get_upvotes.where("created_at >= ?", period.days.ago).count + votes_up = resource.get_upvotes.where("created_at >= ?", period.days.ago).count votes_down = votes_total - votes_up votes_score = votes_up - votes_down diff --git a/spec/features/notifications_spec.rb b/spec/features/notifications_spec.rb index 1b92ca794..3a3ce8ac1 100644 --- a/spec/features/notifications_spec.rb +++ b/spec/features/notifications_spec.rb @@ -217,6 +217,7 @@ describe "Notifications" do Notification.send_pending now = Notification.first_batch_run_at + first_batch_run_at = now.change(usec: 0) second_batch_run_at = (now + 1.second).change(usec: 0) third_batch_run_at = (now + 2.seconds).change(usec: 0) diff --git a/spec/models/newsletter_spec.rb b/spec/models/newsletter_spec.rb index fe8867d74..d04f7e8d0 100644 --- a/spec/models/newsletter_spec.rb +++ b/spec/models/newsletter_spec.rb @@ -100,6 +100,7 @@ describe Newsletter do newsletter.deliver now = newsletter.first_batch_run_at + first_batch_run_at = now.change(usec: 0) second_batch_run_at = (now + 1.second).change(usec: 0) third_batch_run_at = (now + 2.seconds).change(usec: 0) diff --git a/spec/models/proposal_spec.rb b/spec/models/proposal_spec.rb index baa89c32b..625ef2fc5 100644 --- a/spec/models/proposal_spec.rb +++ b/spec/models/proposal_spec.rb @@ -607,11 +607,11 @@ describe Proposal do end it "orders by weight and then by votes" do - title_some_votes = create(:proposal, title: "stop corruption", cached_votes_up: 5) - title_least_voted = create(:proposal, title: "stop corruption", cached_votes_up: 2) - title_most_voted = create(:proposal, title: "stop corruption", cached_votes_up: 10) + title_some_votes = create(:proposal, title: "stop corruption", cached_votes_up: 5) + title_least_voted = create(:proposal, title: "stop corruption", cached_votes_up: 2) + title_most_voted = create(:proposal, title: "stop corruption", cached_votes_up: 10) - summary_most_voted = create(:proposal, summary: "stop corruption", cached_votes_up: 10) + summary_most_voted = create(:proposal, summary: "stop corruption", cached_votes_up: 10) results = Proposal.search("stop corruption")