Skip to content

Commit

Permalink
Set impossible to needing 2/3 to be set.
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielJackson-Oslo committed Feb 29, 2024
1 parent 14c7d3f commit 2eb28f3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/services/spaces/aggregate_facility_reviews_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ def aggregate_reviews(facility) # rubocop:disable Metrics/AbcSize
return handle_zero_facility_reviews(space_facility, belongs_to_space_type) if count.zero?

# Set criteria:
positive_threshold = reviews.positive.count >= (count / 3.0 * 2.0).ceil
impossible_threshold = reviews.impossible.count >= (count / 2.0).ceil
negative_threshold = reviews.negative.count >= (count / 3.0 * 2.0).ceil
two_out_of_three = (count / 3.0 * 2.0).ceil
positive_threshold = reviews.positive.count >= two_out_of_three
impossible_threshold = reviews.impossible.count >= two_out_of_three
negative_threshold = reviews.negative.count >= two_out_of_three

set_relevance(space_facility, belongs_to_space_type, positive_threshold)

Expand Down

0 comments on commit 2eb28f3

Please sign in to comment.