Empty SpectacleRevente and ChoixRevente before do_tirage.

- Usefull if a tirage is launched more than once.
- Ensure full reset of reventes for this tirage in this case.
This commit is contained in:
Aurélien Delobelle 2017-04-07 17:04:06 +02:00
parent 9f307c1bd0
commit d31101aff3

View file

@ -337,6 +337,18 @@ def do_tirage(tirage_elt, token):
# On inscrit à BdA-Revente ceux qui n'ont pas eu les places voulues
ChoixRevente = Participant.choicesrevente.through
# Suppression des reventes demandées/enregistrées (si le tirage est relancé)
(
ChoixRevente.objects
.filter(spectacle__tirage=tirage_elt)
.delete()
)
(
SpectacleRevente.objects
.filter(attribution__spectacle__tirage=tirage_elt)
.delete()
)
lost_by = defaultdict(set)
for show, _, losers in results:
for loser, _, _, _ in losers: