From 8db48700577a182b882f7454c50fb0db84fa05b8 Mon Sep 17 00:00:00 2001 From: zuma Date: Tue, 10 Jun 2025 23:17:50 +0200 Subject: [PATCH] Fix: Commander db name in types --- backend/hooks.go | 1 + backend/types.go | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/hooks.go b/backend/hooks.go index a62c18e..eda5c4b 100644 --- a/backend/hooks.go +++ b/backend/hooks.go @@ -256,6 +256,7 @@ func updateEloCommanderWithLastMatch(e *core.RecordEvent, commanderId string, da AndWhere(dbx.Or(dbx.NewExp("commandant_1 = {:id}", dbx.Params{"id": commanderId}), dbx.NewExp("commandant_2 = {:id}", dbx.Params{"id": commanderId}))). OrderBy("date DESC"). One(&lastMatch) + if err == nil { // If a match exists before this one update ELO if lastMatch.Commander1 == commanderId { diff --git a/backend/types.go b/backend/types.go index af65399..5f28a02 100644 --- a/backend/types.go +++ b/backend/types.go @@ -61,8 +61,8 @@ type Elo struct { Date string `db:"date" json:"date"` Player1 string `db:"player_1" json:"player_1"` Player2 string `db:"player_2" json:"player_2"` - Commander1 string `db:"commander_1" json:"commander_1"` - Commander2 string `db:"commander_2" json:"commander_2"` + Commander1 string `db:"commandant_1" json:"commander_1"` + Commander2 string `db:"commandant_2" json:"commander_2"` Score1 int `db:"score_1" json:"score_1"` Score2 int `db:"score_2" json:"score_2"` Official bool `db:"official" json:"official"`