From 004aec7ad6fb142504685041e0f32335a23fe2e0 Mon Sep 17 00:00:00 2001 From: Ant Zucaro Date: Sat, 24 Sep 2022 20:06:04 -0400 Subject: [PATCH] Handle inactive players or servers in materialized views. --- scripts/refresh_active_servers_mv.sql | 1 + scripts/refresh_player_agg_stats_mv.sql | 2 ++ 2 files changed, 3 insertions(+) diff --git a/scripts/refresh_active_servers_mv.sql b/scripts/refresh_active_servers_mv.sql index 05bdf7b..10c8847 100644 --- a/scripts/refresh_active_servers_mv.sql +++ b/scripts/refresh_active_servers_mv.sql @@ -10,6 +10,7 @@ begin from servers s join games g on g.server_id = s.server_id join player_game_stats pgs on g.game_id = pgs.game_id where pgs.player_id > 1 + and s.active_ind = true and g.create_dt > cutoff and pgs.create_dt > cutoff group by s.server_id, s.name diff --git a/scripts/refresh_player_agg_stats_mv.sql b/scripts/refresh_player_agg_stats_mv.sql index cf99aa5..b75f064 100644 --- a/scripts/refresh_player_agg_stats_mv.sql +++ b/scripts/refresh_player_agg_stats_mv.sql @@ -76,6 +76,8 @@ begin join players p on p.player_id = agg_stats.player_id + where + p.active_ind = true group by p.player_id, p.nick, -- 2.39.2