fix total_score to sum individual honors instead of crew scores

This commit is contained in:
Justin Edmund 2025-12-04 03:02:18 -08:00
parent 5968ed74d5
commit b4f4f9c304
2 changed files with 7 additions and 2 deletions

View file

@ -6,7 +6,7 @@ module Api
fields :preliminary_ranking, :final_ranking
field :total_score do |participation|
participation.total_crew_score
participation.total_individual_honors
end
field :wins do |participation|

View file

@ -9,11 +9,16 @@ class CrewGwParticipation < ApplicationRecord
validates :crew_id, uniqueness: { scope: :gw_event_id, message: 'is already participating in this event' }
# Get total crew score across all rounds
# Get total crew score across all rounds (from crew battles)
def total_crew_score
gw_crew_scores.sum(:crew_score)
end
# Get total individual honors (sum of all member scores)
def total_individual_honors
gw_individual_scores.sum(:score)
end
# Get wins count
def wins_count
gw_crew_scores.where(victory: true).count