Correction dans la vue do_tirage

La graine du tirage est sauvegardée et on renomme la variable
`tirage` pour lever l'ambiguïté avec la fonction `tirage`.
This commit is contained in:
Martin Pépin 2016-06-05 16:00:46 +02:00
parent 299c5f0823
commit f14a99cb07

View file

@ -162,15 +162,17 @@ def inscription(request, tirage_id):
"stateerror": stateerror}) "stateerror": stateerror})
def do_tirage(request, tirage_id): def do_tirage(request, tirage_id):
tirage = get_object_or_404(Tirage, id=tirage_id) tirage_elt = get_object_or_404(Tirage, id=tirage_id)
form = TokenForm(request.POST) form = TokenForm(request.POST)
if not form.is_valid(): if not form.is_valid():
return tirage(request) return tirage(request)
tirage_elt.token = form.cleaned_data['token']
tirage_elt.save()
start = time.time() start = time.time()
data = {} data = {}
shows = Spectacle.objects.filter(tirage=tirage).select_related().all() shows = Spectacle.objects.filter(tirage=tirage_elt).select_related().all()
members = Participant.objects.filter(tirage=tirage).all() members = Participant.objects.filter(tirage=tirage_elt).all()
choices = ChoixSpectacle.objects.filter(spectacle__tirage=tirage).order_by( choices = ChoixSpectacle.objects.filter(spectacle__tirage=tirage_elt).order_by(
'participant', 'priority').select_related().all() 'participant', 'priority').select_related().all()
algo = Algorithm(shows, members, choices) algo = Algorithm(shows, members, choices)
results = algo(form.cleaned_data["token"]) results = algo(form.cleaned_data["token"])