Commit 38fa4852 authored by raida's avatar raida

Add progress bar

parent 1b3deed5
......@@ -8,11 +8,7 @@
<li role="presentation"><a href="{{ NOTE_ROOT_URL }}wei/1a/">{% trans "Retour" %}</a></li>
{% endblock %}
{% block content %}
<h1>DEBUG</h1>
{{ wei }}
{% block content %}*
<h1>{% trans "Questionnaire d'ambiance" %}</h1>
<p>
......@@ -28,6 +24,8 @@
<div style="height: 50px"></div>
{% if liste %}
<progress value="{{ nb_quest / 20 * 100}}" max="100"></progress>
<form action="{{ NOTE_ROOT_URL }}wei/formulaire/" method="POST">
{% csrf_token %}
{% for item in liste %}
......
......@@ -1655,6 +1655,7 @@ def WEI1A(request, sock, kwargs):
request.session["wei1A2019"]["infos"] = form.cleaned_data["infos"]
request.session["wei1A2019"]["soge"] = 't' if form.cleaned_data["soge"] else 'f'
request.session["wei1A2019"]["etranger"] = 't' if form.cleaned_data["etranger"] else 'f'
request.session["nb_quest"] = 0;
if out["retcode"] != 0:
messages.add_error(request, out["errmsg"])
......@@ -1709,11 +1710,13 @@ def WEI1Aalgo(request, sock, kwargs):
variables["form"] = forms.WEI1AForm(label_suffix=_(u" :"))
variables["type"] = '1a'
variables["liste"] = algo1a.test(True, [], request.session["wei1A2019"]["nom"] + request.session["wei1A2019"]["prenom"])
request.session["nb_quest"] = 0
elif request.method == "POST":
separator = "#" if request.session["quest"] != "" else ""
request.session["quest"] += separator + request.POST.get("reponse")
variables["liste"] = algo1a.test(True, request.session["quest"].split("#"), request.session["wei1A2019"]["nom"] + request.session["wei1A2019"]["prenom"])
request.session["nb_quest"] += 1
if variables["liste"] is None: # Fin du questionnaire
request.session["wei1A2019"]["quest"] = request.session["quest"]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment