Open Abdulwahaab710 opened 3 years ago
When a user updates the points for a challenge, we should update the score for all team in a background job. Maybe something like the following:
Team.all.each do |team| team.update(score: calculate_team_new_score(team)) end def calculate_team_new_score(team) Submission.where(team: team, valid_submission: true).map { |s| s.challenge.points }.sum end
When a user updates the points for a challenge, we should update the score for all team in a background job. Maybe something like the following: