Skip to content

Commit

Permalink
298 Fix rubocop issues in evaluation_score model
Browse files Browse the repository at this point in the history
  • Loading branch information
cpreisinger committed Jan 8, 2025
1 parent 9e7a9e0 commit f92cf64
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions app/models/evaluation_score.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,11 @@ def validate_numeric_score
if score && score > max_score
errors.add(:score, "must be less than or equal to #{max_score}")
end

if score_override && score_override > max_score
errors.add(:score_override, "must be less than or equal to #{max_score}")
end

# This is written differently than above because of rubocop
return unless score_override && score_override > max_score

errors.add(:score_override, "must be less than or equal to #{max_score}")
end

def validate_range_score
Expand All @@ -81,9 +82,10 @@ def validate_range_score
errors.add(:score, "must be within the range #{range_start} to #{range_end}")
end

if score_override && valid_range.exclude?(score_override)
errors.add(:score_override, "must be within the range #{range_start} to #{range_end}")
end
# This is written differently than above because of rubocop
return unless score_override && valid_range.exclude?(score_override)

errors.add(:score_override, "must be within the range #{range_start} to #{range_end}")
end

def validate_score_presence
Expand Down

0 comments on commit f92cf64

Please sign in to comment.