Skip to content

Commit

Permalink
"un-cache" results when a poll is unarchived
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelm committed Apr 29, 2024
1 parent cd58c01 commit 91c1a83
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions server/venueless/core/models/poll.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ class Types(models.TextChoices):
objects = PollManager()

def save(self, *args, **kwargs):
if (
self.state in (self.States.CLOSED, self.States.ARCHIVED)
and not self.cached_results
):
self.cached_results = self.get_results()
if self.state in (self.States.CLOSED, self.States.ARCHIVED):
if not self.cached_results:
self.cached_results = self.get_results()
else:
self.cached_results = None
return super().save(*args, **kwargs)

def get_results(self):
Expand Down

0 comments on commit 91c1a83

Please sign in to comment.