forked from MarseyWorld/MarseyWorld
put number of sidebars and banners contributed in badges
parent
9fb950768a
commit
7130752899
|
@ -86,7 +86,16 @@ class Badge(Base):
|
|||
else:
|
||||
return self.name
|
||||
|
||||
return f'{self.name} - {text}'
|
||||
text = f'{self.name} - {text}'
|
||||
|
||||
if self.badge_id in {99, 331, 332}:
|
||||
s = 's' if self.user.sidebar_num > 1 else ''
|
||||
text += f' ({self.user.sidebar_num} sidebar image{s})'
|
||||
elif self.badge_id in {101, 333, 334}:
|
||||
s = 's' if self.user.banner_num > 1 else ''
|
||||
text += f' ({self.user.banner_num} banner{s})'
|
||||
|
||||
return text
|
||||
|
||||
@property
|
||||
@lazy
|
||||
|
|
|
@ -38,6 +38,7 @@ from .hole_logs import *
|
|||
from .subscriptions import *
|
||||
from .userblock import *
|
||||
from .usermute import *
|
||||
from .art_submissions import *
|
||||
|
||||
if SITE == 'devrama.net':
|
||||
DEFAULT_ADMIN_LEVEL = 3
|
||||
|
@ -1482,6 +1483,16 @@ class User(Base):
|
|||
|
||||
return ' '.join(classes)
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def sidebar_num(self):
|
||||
return g.db.query(ArtSubmission).filter_by(kind='sidebar', author_id=self.id, approved=True).count()
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def banner_num(self):
|
||||
return g.db.query(ArtSubmission).filter_by(kind='banner', author_id=self.id, approved=True).count()
|
||||
|
||||
|
||||
|
||||
badge_ordering_tuple = PATRON_BADGES + (
|
||||
|
|
Loading…
Reference in New Issue