#58 Voting UI is bugged when no vote was submitted

This commit is contained in:
2021-12-31 15:56:31 +01:00
parent 1de203ad40
commit 78efe9bebb
4 changed files with 27 additions and 19 deletions

View File

@@ -94,7 +94,9 @@ class Place(Submittable, Taggable, Mapable):
self.remove_expired_votes()
if self.placevotings.count() == 0:
return 5
self.level = 5
self.save()
return
level = 0
@@ -102,6 +104,7 @@ class Place(Submittable, Taggable, Mapable):
level += vote.vote
self.level = floor(level / self.placevotings.count())
self.save()
def remove_expired_votes(self):
for vote in self.placevotings.all():