From 0634ef5894f014d3cb51967912e9978952003527 Mon Sep 17 00:00:00 2001 From: fireworks88 Date: Wed, 11 Aug 2021 22:20:37 +0200 Subject: [PATCH] sex --- files/classes/submission.py | 4 ++-- files/routes/awards.py | 1 + files/templates/submission.html | 8 +++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/files/classes/submission.py b/files/classes/submission.py index 2cbed4278..fe803d729 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -286,8 +286,8 @@ class Submission(Base, Stndrd, Age_times, Scores, Fuzzing): return data - def has_award(self, kind): - return bool(len([x for x in self.awards if x.kind == kind])) + def award_count(self, kind) -> int: + return len([x for x in self.awards if x.kind == kind]) @property def title(self): diff --git a/files/routes/awards.py b/files/routes/awards.py index 7fafd9a14..c347eb24e 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -29,6 +29,7 @@ ACTIONS = { ALLOW_MULTIPLE = ( "ban", + "shit" ) diff --git a/files/templates/submission.html b/files/templates/submission.html index a2292f784..ec41b8ff9 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -175,14 +175,16 @@ {% block content %} -{% if p.has_award("shit") %} +{% if p.award_count("shit") %} +{% set minbugs = 10*p.award_count("shit") if p.award_count("shit") <= 5 else 50 %} +{% set maxbugs = 20*p.award_count("shit") if p.award_count("shit") <= 5 else 100 %}