From bf5f8e927a19f468c889a0da96c6aab8f4222145 Mon Sep 17 00:00:00 2001 From: Samuel Cattini-Schultz Date: Sat, 30 Nov 2024 13:12:08 +1100 Subject: [PATCH] Skip expensive queries when not used --- leaderboards/services.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/leaderboards/services.py b/leaderboards/services.py index fb6a07b1..80fdbad9 100644 --- a/leaderboards/services.py +++ b/leaderboards/services.py @@ -78,9 +78,10 @@ def update_membership( rank=leaderboard.member_count + 1, ) - # Get leaderboard records before updating, so we can compare - pp_record = leaderboard.get_pp_record() - leaderboard_top_player = leaderboard.get_top_membership() + if not skip_notifications and leaderboard.notification_discord_webhook_url != "": + # Get leaderboard records before updating, so we can compare for notifications + pp_record = leaderboard.get_pp_record() + leaderboard_top_player = leaderboard.get_top_membership() scores = Score.objects.filter( user_stats__user_id=user_id, user_stats__gamemode=leaderboard.gamemode