Cap points_ratio for tags statistics at 1.0

This commit is contained in:
Sebastian Serth
2020-10-28 16:26:40 +01:00
parent 9bd15bbbea
commit 4cc9bc49fe

View File

@ -171,6 +171,8 @@ class ProxyExercise < ApplicationRecord
if points_ratio == 0.0
Rails.logger.debug("scoring user #{user.id} for exercise #{ex.id}: points_ratio=#{points_ratio} score: 0" )
return 0.0
elsif points_ratio > 1.0
points_ratio = 1.0 # The score of the exercise was adjusted and is now lower than it was
end
points_ratio_index = ((scoring_matrix.size - 1) * points_ratio).to_i
working_time_user = ex.accumulated_working_time_for_only(user)