forked from rDrama/rDrama
1
0
Fork 0
master
Aevann1 2021-09-17 13:52:42 +02:00
parent 8c625cd063
commit 2dce325a5a
1 changed files with 12 additions and 12 deletions

View File

@ -195,6 +195,17 @@ class User(Base, Stndrd, Age_times):
super().__init__(**kwargs)
@property
@lazy
def user_awards(v):
return_value = list(AWARDS.values())
user_awards = v.awards
for val in return_value: val['owned'] = user_awards.filter_by(kind=val['kind'], submission_id=None, comment_id=None).count()
return jsonify(return_value)
@property
@lazy
def referral_count(self):
@ -657,15 +668,4 @@ class ViewerRelationship(Base):
return f"{months}mo ago"
else:
years = int(months / 12)
return f"{years}yr ago"
@property
@lazy
def user_awards(v):
return_value = list(AWARDS.values())
user_awards = v.awards
for val in return_value: val['owned'] = user_awards.filter_by(kind=val['kind'], submission_id=None, comment_id=None).count()
return jsonify(return_value)
return f"{years}yr ago"