Add questions count
This commit is contained in:
parent
c95c0dcb94
commit
3c66fd8ac4
@ -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.-->
|
||||||
|
@ -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.-->
|
||||||
|
@ -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.-->
|
||||||
|
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user