From c6cdf9fdcac22f5e69dc9be37871d27dc5c32249 Mon Sep 17 00:00:00 2001 From: Aevann Date: Wed, 3 May 2023 19:06:14 +0300 Subject: [PATCH] minor fixes to last couple of commits --- files/helpers/awards.py | 5 ++++- files/routes/admin.py | 2 +- .../20230503-add-new-patron-tier-for-benefactorcels.sql | 3 +++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/files/helpers/awards.py b/files/helpers/awards.py index dce8ed02b..fd96aa97f 100644 --- a/files/helpers/awards.py +++ b/files/helpers/awards.py @@ -17,6 +17,9 @@ def award_timers(v, bot=False): v.patron = 0 v.patron_utc = 0 notify_if_not_bot(f"Your {patron} status has expired!") + for i in (22,23,24,25,26,27,28): + badge = v.has_badge(i) + if badge: g.db.delete(badge) if v.unban_utc and v.unban_utc < now: v.is_banned = None v.unban_utc = 0 @@ -27,7 +30,7 @@ def award_timers(v, bot=False): v.agendaposter_phrase = None v.chudded_by = None notify_if_not_bot("Your chud status has expired!") - badge = v.has_badge(28) + badge = v.has_badge(58) if badge: g.db.delete(badge) if v.flairchanged and v.flairchanged < now: v.flairchanged = None diff --git a/files/routes/admin.py b/files/routes/admin.py index e9d756808..d1b953323 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -804,7 +804,7 @@ def unagendaposter(id, v): g.db.add(ma) - badge = user.has_badge(28) + badge = user.has_badge(58) if badge: g.db.delete(badge) send_repeatable_notification(user.id, f"@{v.username} (a site admin) has unchudded you.") diff --git a/migrations/20230503-add-new-patron-tier-for-benefactorcels.sql b/migrations/20230503-add-new-patron-tier-for-benefactorcels.sql index 25bf96271..d492ec16b 100644 --- a/migrations/20230503-add-new-patron-tier-for-benefactorcels.sql +++ b/migrations/20230503-add-new-patron-tier-for-benefactorcels.sql @@ -1,3 +1,4 @@ +update badge_defs set name='X', description='X' where id=21; update badge_defs set name='Paypig', description='Contributes $5/month' where id=22; update badge_defs set name='Renthog', description='Contributes $10/month' where id=23; update badge_defs set name='Landchad', description='Contributes $20/month' where id=24; @@ -20,3 +21,5 @@ update users set patron=5 where id in (select user_id from badges where badge_id update users set patron=6 where id in (select user_id from badges where badge_id=26); update users set patron=7 where id in (select user_id from badges where badge_id=27); update users set patron=8 where id in (select user_id from badges where badge_id=28); + +update users set patron=0 where patron>0 and patron_utc=0;