Merge pull request 'Add questions count' (#28) from feature/question-count into master
Reviewed-on: #28
This commit is contained in:
commit
36970110a9
@ -12,7 +12,7 @@
|
||||
<div class="mainTestMeta">
|
||||
<div class="left">Kategoria: {{test.category}}</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 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.-->
|
||||
|
@ -12,7 +12,7 @@
|
||||
<div class="mainTestMeta">
|
||||
<div class="left">Kategoria: {{test.category}}</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 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.-->
|
||||
|
@ -12,7 +12,7 @@
|
||||
<div class="mainTestMeta">
|
||||
<div class="left">Kategoria: {{test.category}}</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 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.-->
|
||||
|
@ -1,4 +1,6 @@
|
||||
from django.db import models
|
||||
|
||||
from questions.models import Question
|
||||
from .managers import TestManager
|
||||
|
||||
|
||||
@ -62,6 +64,9 @@ class Test(models.Model):
|
||||
points += question.points
|
||||
return points
|
||||
|
||||
def question_count(self):
|
||||
return Question.objects.filter(test_id=self.id).count()
|
||||
|
||||
def name_and_passing_score(self):
|
||||
return {
|
||||
"name": self.name,
|
||||
|
Loading…
Reference in New Issue
Block a user