From daa8e4709053fe400a0462584def22ab3879f2fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20P=C3=A9pin?= Date: Thu, 16 Jun 2016 00:39:55 +0200 Subject: [PATCH 1/2] Supprime les bonnes attributions lors d'un tirage. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ne supprime plus toutes les attributions en lançant un tirage mais seulement les attributions du tirage que l'on lance. Fixes #44 --- bda/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bda/views.py b/bda/views.py index 41c3c94d..3f206e63 100644 --- a/bda/views.py +++ b/bda/views.py @@ -237,7 +237,9 @@ def do_tirage(request, tirage_id): # FIXME: Établir les conditions de validations (formulaire ?) # cf. issue #32 if False: - Attribution.objects.all().delete() + Attribution.objects.filter( + spectacle__tirage=tirage_elt + ).all().delete() for (show, members, _) in results: for (member, _, _, _) in members: attrib = Attribution(spectacle=show, participant=member) From 976a130dcb179b2acc912fd5940333f93234507d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20P=C3=A9pin?= Date: Thu, 16 Jun 2016 09:31:08 +0200 Subject: [PATCH 2/2] Suppression d'un `.all()` inutile. --- bda/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bda/views.py b/bda/views.py index 3f206e63..2fdd7542 100644 --- a/bda/views.py +++ b/bda/views.py @@ -239,7 +239,7 @@ def do_tirage(request, tirage_id): if False: Attribution.objects.filter( spectacle__tirage=tirage_elt - ).all().delete() + ).delete() for (show, members, _) in results: for (member, _, _, _) in members: attrib = Attribution(spectacle=show, participant=member)