develop/soita-2.0 #36
@ -9,25 +9,25 @@
|
||||
<div class="resultBody">
|
||||
<h5 class="resultMsg">
|
||||
<!-- Quite good! All the best for next quiz!-->
|
||||
{% if percentage == 100 %}
|
||||
{% if request.session.percentage == 100 %}
|
||||
Idealnie, widzę że ten temat nie ma dla ciebie tajemnic!
|
||||
{% elif percentage >= 75 %}
|
||||
{% elif request.session.percentage >= 75 %}
|
||||
Bardzo dobrze, ale są jeszcze pewne braki ;)
|
||||
{% elif percentage >= 50 %}
|
||||
{% elif request.session.percentage >= 50 %}
|
||||
Nie jest źle, wiedziałeś więcej niż mniej
|
||||
{% elif percentage >= 25 %}
|
||||
{% elif request.session.percentage >= 25 %}
|
||||
Masz spore braki, powinieneś trochę więcej się pouczyć
|
||||
{% else %}
|
||||
Słabiutko, ale następnym razem będzie lepiej
|
||||
{% endif %}
|
||||
</h5>
|
||||
<h5 class="resultScore">Rezultat: {{ status }}</h5>
|
||||
<h5 class="resultText">Twój wynik: {{ points }}</h5>
|
||||
<h5 class="resultText">Próg zaliczenia: {{ passing }}</h5>
|
||||
<h5 class="resultText">Maksymalny wynik: {{ max }}</h5>
|
||||
<h5 class="resultText">Wynik procentowy: {{ percentage }}%</h5>
|
||||
<h5 class="resultScore">Rezultat: {{ request.session.status }}</h5>
|
||||
<h5 class="resultText">Twój wynik: {{ request.session.points }}</h5>
|
||||
<h5 class="resultText">Próg zaliczenia: {{ request.session.passing }}</h5>
|
||||
<h5 class="resultText">Maksymalny wynik: {{ request.session.max }}</h5>
|
||||
<h5 class="resultText">Wynik procentowy: {{ request.session.percentage }}%</h5>
|
||||
<button class="defaultButton"><a href="{% url 'home' %}">Strona główna</a></button>
|
||||
{% if password == "" %}
|
||||
{% if request.session.password == "" %}
|
||||
<br>
|
||||
<h5>Udostępnij:</h5>
|
||||
{% post_to_facebook object_or_url %}
|
||||
|
@ -336,14 +336,20 @@ class TestTemplateView(TemplateView):
|
||||
score = self.get_score(test, self.formatted_responses(request.POST))
|
||||
max = self.get_maxscore(test, self.formatted_responses(request.POST))
|
||||
status = score >= test.passing_score
|
||||
context = {
|
||||
"status": self.PASSED.get(status, self.UNKNOWN),
|
||||
"points": score,
|
||||
"max": max,
|
||||
"passing": test.passing_score,
|
||||
"percentage": int(score / max * 100),
|
||||
"password": test.password
|
||||
}
|
||||
# context = {
|
||||
# "status": self.PASSED.get(status, self.UNKNOWN),
|
||||
# "points": score,
|
||||
# "max": max,
|
||||
# "passing": test.passing_score,
|
||||
# "percentage": int(score / max * 100),
|
||||
# "password": test.password
|
||||
# }
|
||||
request.session["status"] = self.PASSED.get(status, self.UNKNOWN)
|
||||
request.session["points"] = score
|
||||
request.session["max"] = max
|
||||
request.session["passing"] = test.passing_score
|
||||
request.session["percentage"] = int(score / max * 100)
|
||||
request.session["password"] = test.password
|
||||
SolvedTest.objects.create(
|
||||
score=score,
|
||||
max=max,
|
||||
@ -351,9 +357,7 @@ class TestTemplateView(TemplateView):
|
||||
user=request.user,
|
||||
test=test
|
||||
)
|
||||
template_name = "result.html"
|
||||
template = get_template(template_name)
|
||||
return HttpResponse(template.render(context, request))
|
||||
return HttpResponseRedirect(f'result')
|
||||
|
||||
|
||||
def TestPasswordTemplateView(request, test_id):
|
||||
|
Loading…
Reference in New Issue
Block a user