Rend la page état des demandes/ratios cohérente
- Le nombre total de demandes affiché est désormais le nombre de places demandées et non le nombre de personnes ayant fait des demandes. Ainsi ce nombre correspond à la somme des totaux par spectacle affiché - Au passage, on déplace le template de cette vue dans un dossier plus adéquat et on ajoute une docstring sur la vue.
This commit is contained in:
parent
672b8727b7
commit
4f66f161b0
2 changed files with 14 additions and 13 deletions
|
@ -38,7 +38,7 @@
|
|||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<span class="bda-prix">Total : {{ total }} demandes</span>
|
||||
<span class="bda-prix">Total : {{ total }} places demandées</span>
|
||||
<script type="text/javascript"
|
||||
src="{% static "js/jquery.min.js" %}"></script>
|
||||
<script type="text/javascript"
|
25
bda/views.py
25
bda/views.py
|
@ -1,10 +1,10 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import random
|
||||
import hashlib
|
||||
import time
|
||||
|
||||
from datetime import timedelta
|
||||
|
||||
from django.shortcuts import render, get_object_or_404
|
||||
from django.contrib.auth.decorators import login_required
|
||||
|
@ -15,27 +15,28 @@ from django.forms.models import inlineformset_factory
|
|||
from django.http import HttpResponseBadRequest, HttpResponseRedirect
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.conf import settings
|
||||
import hashlib
|
||||
|
||||
from django.core.mail import send_mail
|
||||
from django.template import loader
|
||||
from django.utils import timezone
|
||||
from django.views.generic.list import ListView
|
||||
|
||||
import time
|
||||
from datetime import timedelta
|
||||
|
||||
from gestioncof.decorators import cof_required, buro_required
|
||||
from bda.models import Spectacle, Participant, ChoixSpectacle, Attribution,\
|
||||
Tirage, SpectacleRevente
|
||||
from bda.algorithm import Algorithm
|
||||
|
||||
from bda.forms import BaseBdaFormSet, TokenForm, ResellForm, AnnulForm,\
|
||||
InscriptionReventeForm
|
||||
|
||||
|
||||
@cof_required
|
||||
def etat_places(request, tirage_id):
|
||||
"""
|
||||
Résumé des spectacles d'un tirage avec pour chaque spectacle :
|
||||
- Le nombrede places en jeu
|
||||
- Le nombre de demandes
|
||||
- Le ratio demandes/places
|
||||
Et le total de toutes les demandes
|
||||
"""
|
||||
tirage = get_object_or_404(Tirage, id=tirage_id)
|
||||
spectacles1 = ChoixSpectacle.objects \
|
||||
.filter(spectacle__tirage=tirage) \
|
||||
|
@ -67,8 +68,8 @@ def etat_places(request, tirage_id):
|
|||
spectacles_dict[spectacle["spectacle"]].ratio = \
|
||||
spectacles_dict[spectacle["spectacle"]].total / \
|
||||
spectacles_dict[spectacle["spectacle"]].slots
|
||||
total += spectacle["total"]
|
||||
return render(request, "etat-places.html",
|
||||
total += 2*spectacle["total"]
|
||||
return render(request, "bda/etat-places.html",
|
||||
{"spectacles": spectacles, "total": total, 'tirage': tirage})
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue