Skip to content

Commit

Permalink
Force query evaluation on solution resubmit
Browse files Browse the repository at this point in the history
This probably broke somewhere during the upgrade process from Django 2.2 to 5.1.
  • Loading branch information
hannesbraun committed Oct 14, 2024
1 parent cced33d commit 72f8c3a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/solutions/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,12 @@ def copy(self):
""" create a copy of this solution """
self.final = False
self.save()
solutionfiles = self.solutionfile_set.all()
checkerresults = self.checkerresult_set.all()
# We need to force the evaluation of the following queries before
# duplicating the solution object in the database.
# Otherwise, the queries will be executed for the new object instead of
# the old one (and nothing will be found).
solutionfiles = list(self.solutionfile_set.all())
checkerresults = list(self.checkerresult_set.all())
self.id = None
self.number = None
self.final = True
Expand Down

0 comments on commit 72f8c3a

Please sign in to comment.