im retarded

pull/146/head
Aevann 2023-05-07 20:28:35 +03:00
parent c8079e1d9d
commit 9c5015d662
1 changed files with 13 additions and 10 deletions

View File

@ -414,22 +414,25 @@ class User(Base):
@property
@lazy
def is_cakeday(self):
return_value = False
if time.time() - self.created_utc > 363 * 86400:
date = time.strftime("%d %b", time.gmtime(self.created_utc))
now = time.strftime("%d %b", time.gmtime())
if date == now: return True
if date == now:
return_value = True
if time.time() - self.created_utc > 363 * 86400 and not self.has_badge(134):
new_badge = Badge(badge_id=134, user_id=self.id)
g.db.add(new_badge)
g.db.flush()
if time.time() - self.created_utc > 365 * 86400 and not self.has_badge(134):
new_badge = Badge(badge_id=134, user_id=self.id)
g.db.add(new_badge)
g.db.flush()
if time.time() - self.created_utc > 363 * 86400 * 2 and not self.has_badge(237):
new_badge = Badge(badge_id=237, user_id=self.id)
g.db.add(new_badge)
g.db.flush()
if time.time() - self.created_utc > 365 * 86400 * 2 and not self.has_badge(237):
new_badge = Badge(badge_id=237, user_id=self.id)
g.db.add(new_badge)
g.db.flush()
return False
return return_value
@property
@lazy