mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-06-23 00:38:25 +02:00
Duplicate solutions from regional tournament to final tournament after selection
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
@ -850,6 +850,12 @@ class SelectTeamFinalView(VolunteerMixin, DetailView):
|
||||
tournament = self.get_object()
|
||||
self.participation.final = True
|
||||
self.participation.save()
|
||||
for regional_sol in self.participation.solutions.filter(final_solution=False).all():
|
||||
final_sol, _created = Solution.objects.get_or_create(participation=self.participation, final_solution=True,
|
||||
problem=regional_sol.problem)
|
||||
final_sol: Solution
|
||||
with open(regional_sol.file.path, 'rb') as f:
|
||||
final_sol.file.save(regional_sol.file.name, f)
|
||||
return redirect(reverse_lazy("participation:tournament_detail", args=(tournament.pk,)))
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user