From b4f4f9c304040dfda7aab781ec1d6abe15fc0229 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Thu, 4 Dec 2025 03:02:18 -0800 Subject: [PATCH] fix total_score to sum individual honors instead of crew scores --- app/blueprints/api/v1/crew_gw_participation_blueprint.rb | 2 +- app/models/crew_gw_participation.rb | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/blueprints/api/v1/crew_gw_participation_blueprint.rb b/app/blueprints/api/v1/crew_gw_participation_blueprint.rb index e814976..725675d 100644 --- a/app/blueprints/api/v1/crew_gw_participation_blueprint.rb +++ b/app/blueprints/api/v1/crew_gw_participation_blueprint.rb @@ -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| diff --git a/app/models/crew_gw_participation.rb b/app/models/crew_gw_participation.rb index fee4bd0..3081125 100644 --- a/app/models/crew_gw_participation.rb +++ b/app/models/crew_gw_participation.rb @@ -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