Skip to content

Commit

Permalink
Ignore bye matches in statistics, and show progression in practice
Browse files Browse the repository at this point in the history
  • Loading branch information
thordy committed Dec 2, 2024
1 parent cb0727d commit a69d228
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion data/statistics_global.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions data/statistics_x01.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit a69d228

Please sign in to comment.