Skip to content

Commit e789369

Browse files
authored
bug: check if exists (#159)
1 parent 3c8c382 commit e789369

3 files changed

Lines changed: 4 additions & 45 deletions

File tree

hasura/functions/leaderboard/get_leaderboard.sql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,9 @@ BEGIN
358358
SUM(CASE WHEN tt.placement = 3 THEN 1 ELSE 0 END)::int as bronze,
359359
COUNT(*)::int as total
360360
FROM tournament_trophies tt
361-
WHERE (_window_days = 0 OR tt.tournament_start >= NOW() - make_interval(days => _window_days))
361+
JOIN tournaments t ON t.id = tt.tournament_id
362+
WHERE tt.player_steam_id IS NOT NULL
363+
AND (_window_days = 0 OR t.start >= NOW() - make_interval(days => _window_days))
362364
GROUP BY tt.player_steam_id
363365
)
364366
SELECT

hasura/migrations/default/1776430500000_tournament_trophies_unique_include_placement/up.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ BEGIN
1616
WHERE c.conrelid = 'public.tournament_trophies'::regclass
1717
AND c.contype = 'u'
1818
AND (
19-
SELECT array_agg(a.attname ORDER BY a.attname)
19+
SELECT array_agg(a.attname::text ORDER BY a.attname::text)
2020
FROM unnest(c.conkey) AS k(attnum)
2121
JOIN pg_attribute a
2222
ON a.attrelid = c.conrelid AND a.attnum = k.attnum

hasura/triggers/tournament_trophy_configs.sql

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)