remotes/1693045480750635534/spooky-22
Aevann1 2022-01-21 16:40:01 +02:00
parent 4b6176989e
commit 30bd0902fa
3 changed files with 12 additions and 12 deletions

View File

@ -31,19 +31,19 @@ class Badge(Base):
def text(self):
if self.name == "Agendaposter":
ti = self.user.agendaposter_expires_utc
if ti: return self.badge['description'] + " until " + datetime.utcfromtimestamp(ti).strftime('%Y-%m-%d %H:%M:%S')
else: return self.badge['description'] + " permanently"
if ti: text = self.badge['description'] + " until " + datetime.utcfromtimestamp(ti).strftime('%Y-%m-%d %H:%M:%S')
else: text = self.badge['description'] + " permanently"
elif self.badge_id in (94,95,96,97,98):
if self.badge_id == 94: ti = self.user.progressivestack
elif self.badge_id == 95: ti = self.user.bird
elif self.badge_id == 96: ti = self.user.flairchanged
elif self.badge_id == 97: ti = self.user.longpost
else: ti = self.user.marseyawarded
return self.badge['description'] + " until " + datetime.utcfromtimestamp(ti).strftime('%Y-%m-%d %H:%M:%S')
elif self.description: return self.description
else: return self.badge['description']
text = self.badge['description'] + " until " + datetime.utcfromtimestamp(ti).strftime('%Y-%m-%d %H:%M:%S')
elif self.description: text = self.description
elif self.badge['description']: text = self.badge['description']
else: return None
return f' - {text}'
@property
@lazy

View File

@ -63,7 +63,7 @@ class Submission(Base):
@property
@lazy
def comments(self):
return g.db.query(Comment.author_id, Comment.created_utc, Comment.id).filter(Submission.parent_submission == self.id, Submission.author_id.notin_((AUTOPOLLER_ID,AUTOBETTER_ID)))
return g.db.query(Comment.author_id, Comment.created_utc, Comment.id).filter(Comment.parent_submission == self.id, Comment.author_id.notin_((AUTOPOLLER_ID,AUTOBETTER_ID))).all()
@property
@lazy

View File

@ -313,9 +313,9 @@
<div>
{% for b in u.badges %}
{% if b.url %}
<a rel="nofollow noopener noreferrer" href="{{b.url}}"><img alt="{{b.name}}" width=60 height=60 loading="lazy" src="{{b.path}}" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="{{b.name}} - {{b.text}}"></a>
<a rel="nofollow noopener noreferrer" href="{{b.url}}"><img alt="{{b.name}}" width=60 height=60 loading="lazy" src="{{b.path}}" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="{{b.name}}{{b.text}}"></a>
{% else %}
<img alt="{{b.name}}" width=60 height=60 loading="lazy" src="{{b.path}}" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="{{b.name}} - {{b.text}}">
<img alt="{{b.name}}" width=60 height=60 loading="lazy" src="{{b.path}}" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="{{b.name}}{{b.text}}">
{% endif %}
{% endfor %}
</div>
@ -421,9 +421,9 @@
<div class="mb-3">
{% for b in u.badges %}
{% if b.url %}
<a rel="nofollow noopener noreferrer" href="{{b.url}}"><img alt="{{b.name}}" width=32 height=32 loading="lazy" src="{{b.path}}" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="{{b.name}} - {{b.text}}"></a>
<a rel="nofollow noopener noreferrer" href="{{b.url}}"><img alt="{{b.name}}" width=32 height=32 loading="lazy" src="{{b.path}}" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="{{b.name}}{{b.text}}"></a>
{% else %}
<img alt="{{b.name}}" width=32 height=32 loading="lazy" src="{{b.path}}" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="{{b.name}} - {{b.text}}">
<img alt="{{b.name}}" width=32 height=32 loading="lazy" src="{{b.path}}" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="{{b.name}}{{b.text}}">
{% endif %}
{% endfor %}
</div>