This commit is contained in:
Piotr Kopycki 2022-01-30 15:26:30 +01:00
commit 6fa75ab620
4 changed files with 8 additions and 3 deletions

View File

@ -12,7 +12,7 @@
<div class="mainTestMeta"> <div class="mainTestMeta">
<div class="left">Kategoria: {{test.category}}</div> <div class="left">Kategoria: {{test.category}}</div>
<div class="center">Próg zaliczenia: {{test.passing_score}}</div> <div class="center">Próg zaliczenia: {{test.passing_score}}</div>
<div class="right">Ilość pytań: {{test.questions|length}}</div> <div class="right">Ilość pytań: {{test.question_count}}</div>
</div> </div>
<!-- <div class="mainTestDesc">--> <!-- <div class="mainTestDesc">-->
<!-- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus volutpat scelerisque tortor, id sodales leo finibus id. Vivamus id viverra nunc, ac faucibus metus. Nulla a mauris imperdiet sapien lobortis dapibus. Quisque ornare posuere pulvinar.--> <!-- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus volutpat scelerisque tortor, id sodales leo finibus id. Vivamus id viverra nunc, ac faucibus metus. Nulla a mauris imperdiet sapien lobortis dapibus. Quisque ornare posuere pulvinar.-->

View File

@ -12,7 +12,7 @@
<div class="mainTestMeta"> <div class="mainTestMeta">
<div class="left">Kategoria: {{test.category}}</div> <div class="left">Kategoria: {{test.category}}</div>
<div class="center">Próg zaliczenia: {{test.passing_score}}</div> <div class="center">Próg zaliczenia: {{test.passing_score}}</div>
<div class="right">Ilość pytań: {{test.questions|length}}</div> <div class="right">Ilość pytań: {{test.question_count}}</div>
</div> </div>
<!-- <div class="mainTestDesc">--> <!-- <div class="mainTestDesc">-->
<!-- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus volutpat scelerisque tortor, id sodales leo finibus id. Vivamus id viverra nunc, ac faucibus metus. Nulla a mauris imperdiet sapien lobortis dapibus. Quisque ornare posuere pulvinar.--> <!-- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus volutpat scelerisque tortor, id sodales leo finibus id. Vivamus id viverra nunc, ac faucibus metus. Nulla a mauris imperdiet sapien lobortis dapibus. Quisque ornare posuere pulvinar.-->

View File

@ -12,7 +12,7 @@
<div class="mainTestMeta"> <div class="mainTestMeta">
<div class="left">Kategoria: {{test.category}}</div> <div class="left">Kategoria: {{test.category}}</div>
<div class="center">Próg zaliczenia: {{test.passing_score}}</div> <div class="center">Próg zaliczenia: {{test.passing_score}}</div>
<div class="right">Ilość pytań: {{test.questions|length}}</div> <div class="right">Ilość pytań: {{test.question_count}}</div>
</div> </div>
<!-- <div class="mainTestDesc">--> <!-- <div class="mainTestDesc">-->
<!-- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus volutpat scelerisque tortor, id sodales leo finibus id. Vivamus id viverra nunc, ac faucibus metus. Nulla a mauris imperdiet sapien lobortis dapibus. Quisque ornare posuere pulvinar.--> <!-- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus volutpat scelerisque tortor, id sodales leo finibus id. Vivamus id viverra nunc, ac faucibus metus. Nulla a mauris imperdiet sapien lobortis dapibus. Quisque ornare posuere pulvinar.-->

View File

@ -1,4 +1,6 @@
from django.db import models from django.db import models
from questions.models import Question
from .managers import TestManager from .managers import TestManager
@ -62,6 +64,9 @@ class Test(models.Model):
points += question.points points += question.points
return points return points
def question_count(self):
return Question.objects.filter(test_id=self.id).count()
def name_and_passing_score(self): def name_and_passing_score(self):
return { return {
"name": self.name, "name": self.name,