From a69d228a6f2da4e4d56c561c1d07a8e901fbaf06 Mon Sep 17 00:00:00 2001 From: Thord Setsaas Date: Mon, 2 Dec 2024 20:40:32 +0100 Subject: [PATCH] Ignore bye matches in statistics, and show progression in practice --- data/statistics_global.go | 2 +- data/statistics_x01.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data/statistics_global.go b/data/statistics_global.go index 9bac24fb..d30510ef 100644 --- a/data/statistics_global.go +++ b/data/statistics_global.go @@ -22,7 +22,7 @@ func GetGlobalStatistics() (map[int]*models.GlobalStatistics, error) { LEFT JOIN leg l on l.match_id = m.id LEFT JOIN score s on s.leg_id = l.id LEFT JOIN player p on p.id = s.player_id - WHERE m.is_finished = 1 AND m.is_abandoned = 0 AND m.is_walkover = 0 AND (p.id is null OR p.is_bot = 0) + WHERE m.is_finished = 1 AND m.is_abandoned = 0 AND m.is_bye = 0 AND m.is_walkover = 0 AND (p.id is null OR p.is_bot = 0) GROUP BY m.office_id`) if err != nil { return nil, err diff --git a/data/statistics_x01.go b/data/statistics_x01.go index 586c5aab..73abe62e 100644 --- a/data/statistics_x01.go +++ b/data/statistics_x01.go @@ -40,7 +40,7 @@ func GetX01Statistics(from string, to string, matchType int, startingScores ...i LEFT JOIN matches m2 ON m2.id = l.match_id AND m2.winner_id = p.id WHERE m.updated_at >= ? AND m.updated_at < ? AND l.starting_score IN (?) - AND l.is_finished = 1 AND m.is_abandoned = 0 AND m.is_walkover = 0 + AND l.is_finished = 1 AND m.is_abandoned = 0 AND m.is_walkover = 0 AND m.is_bye = 0 AND m.match_type_id = ? GROUP BY p.id, m.office_id ORDER BY(COUNT(DISTINCT m2.id) / COUNT(DISTINCT m.id)) DESC, matches_played DESC, @@ -225,7 +225,7 @@ func GetPlayersX01Statistics(ids []int, startingScores ...int) ([]*models.Statis LEFT JOIN matches m2 ON m2.id = l2.match_id AND l2.winner_id = p.id WHERE s.player_id IN (?) AND l.starting_score IN (?) - AND l.is_finished = 1 AND m.is_abandoned = 0 AND m.is_walkover = 0 + AND l.is_finished = 1 AND m.is_abandoned = 0 AND m.is_walkover = 0 AND m.is_bye = 0 AND COALESCE(l.leg_type_id, m.match_type_id) = 1 GROUP BY s.player_id ORDER BY p.id`, ids, startingScores) @@ -386,7 +386,7 @@ func GetPlayerProgression(id int) (map[string]*models.StatisticsX01, error) { JOIN matches m ON m.id = l.match_id WHERE s.player_id = ? AND m.match_type_id = 1 - AND m.is_finished = 1 AND m.is_abandoned = 0 AND m.is_practice = 0 + AND m.is_finished = 1 AND m.is_abandoned = 0 GROUP BY YEAR(m.updated_at), WEEK(m.updated_at) ORDER BY date DESC`, id) if err != nil {