reduce query volume, badge edition

master
Aevann1 2022-06-26 07:11:25 +02:00
parent 74978bfbf7
commit e36adb5bf4
2 changed files with 3 additions and 9 deletions

View File

@ -233,8 +233,10 @@ class User(Base):
elif self.patron == 7: discount = 0.60 elif self.patron == 7: discount = 0.60
else: discount = 1 else: discount = 1
owned_badges = [x.badge_id for x in self.badges]
for badge in discounts: for badge in discounts:
if self.has_badge(badge): discount -= discounts[badge] if badge in owned_badges: discount -= discounts[badge]
return discount return discount

View File

@ -30,14 +30,6 @@ if path.exists(f'snappy_{SITE_NAME}.txt'):
with open(f'snappy_{SITE_NAME}.txt', "r", encoding="utf-8") as f: with open(f'snappy_{SITE_NAME}.txt', "r", encoding="utf-8") as f:
snappyquotes += f.read().split("\n{[para]}\n") snappyquotes += f.read().split("\n{[para]}\n")
discounts = {
69: 0.02,
70: 0.04,
71: 0.06,
72: 0.08,
73: 0.10,
}
titleheaders = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.72 Safari/537.36"} titleheaders = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.72 Safari/537.36"}