forked from rDrama/rDrama
centeralize award limit of 4
parent
5074dba92c
commit
0e4677d342
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue