forked from rDrama/rDrama
1
0
Fork 0

centeralize award limit of 4

master
Aevann 2023-08-10 00:38:35 +03:00
parent 5074dba92c
commit 0e4677d342
3 changed files with 5 additions and 3 deletions

View File

@ -262,7 +262,8 @@ class Comment(Base):
def award_count(self, kind, v):
if v and v.poor and kind.islower(): return 0
num = len([x for x in self.awards if x.kind == kind])
if kind == 'tilt' and num > 4: return 4
if num > 4 and kind not in {"shit", "fireflies", "gingerbread"}:
return 4
return num
@property

View File

@ -255,7 +255,8 @@ class Post(Base):
return 0
num = len([x for x in self.awards if x.kind == kind])
if kind == 'tilt' and num > 4: return 4
if num > 4 and kind not in {"shit", "fireflies", "gingerbread"}:
return 4
return num
@lazy

View File

@ -1,7 +1,7 @@
<div id="awards-container" class="w-100 h-100">
{% macro stackable_award(award, src, alt) %}
<div class="stackable-container">
{% for i in range(min(p.award_count(award, v), 4)) %}
{% for i in range(p.award_count(award, v)) %}
<div class="{{award}}">
<img loading="lazy" alt="{{alt}}" src="{{src}}">
</div>