Commit dd4d2655298c9805ebdf26f2af33d6ac0a257385
1 parent
e20125b8
Exists in
master
and in
1 other branch
- number of stars now depends on the proportion of correct answers.
Showing
3 changed files
with
12 additions
and
6 deletions
Show diff stats
BUGS.md
1 | 1 | |
2 | 2 | # BUGS |
3 | 3 | |
4 | +- change password modal nao aparece no ipad (safari e firefox) | |
4 | 5 | - on start topic, logs show questionhandler.get() twice. |
5 | 6 | - generators e correct scripts que durem muito tempo podem bloquear o loop do tornado? |
6 | 7 | - detect questions in questions.yaml without ref -> error ou generate default. |
... | ... | @@ -29,6 +30,7 @@ |
29 | 30 | |
30 | 31 | # FIXED |
31 | 32 | |
33 | +- numero de estrelas depende da proporcao entre certas e erradas. | |
32 | 34 | - image brand da universidade está esbatida. |
33 | 35 | - reportar comentarios após submeter. |
34 | 36 | - error if demo.yaml has no topics | ... | ... |
knowledge.py
... | ... | @@ -89,6 +89,8 @@ class StudentKnowledge(object): |
89 | 89 | factory = self.deps.node[topic]['factory'] |
90 | 90 | questionlist = self.deps.node[topic]['questions'] |
91 | 91 | |
92 | + self.correct_answers = 0 | |
93 | + self.wrong_answers = 0 | |
92 | 94 | self.finished_questions = [] |
93 | 95 | self.questions = [factory[qref].generate() for qref in questionlist] |
94 | 96 | logger.debug(f'Total: {len(self.questions)} questions') |
... | ... | @@ -113,9 +115,9 @@ class StudentKnowledge(object): |
113 | 115 | |
114 | 116 | self.current_question = None |
115 | 117 | self.state[self.current_topic] = { |
116 | - 'level': 1.0, | |
117 | - 'date': datetime.now() | |
118 | - } | |
118 | + 'date': datetime.now(), | |
119 | + 'level': self.correct_answers / (self.correct_answers + self.wrong_answers) | |
120 | + } | |
119 | 121 | self.unlock_topics() |
120 | 122 | |
121 | 123 | |
... | ... | @@ -134,6 +136,7 @@ class StudentKnowledge(object): |
134 | 136 | |
135 | 137 | # if answer is correct, get next question |
136 | 138 | if grade > 0.999: |
139 | + self.correct_answers += 1 | |
137 | 140 | self.finished_questions.append(q) |
138 | 141 | try: |
139 | 142 | self.current_question = self.questions.pop(0) # FIXME empty? |
... | ... | @@ -144,6 +147,7 @@ class StudentKnowledge(object): |
144 | 147 | |
145 | 148 | # if answer is wrong, keep same question and add a similar one at the end |
146 | 149 | else: |
150 | + self.wrong_answers += 1 | |
147 | 151 | factory = self.deps.node[self.current_topic]['factory'] |
148 | 152 | self.questions.append(factory[q['ref']].generate()) |
149 | 153 | ... | ... |
templates/maintopics.html
... | ... | @@ -88,9 +88,9 @@ |
88 | 88 | {% if t['type']=='chapter' %} |
89 | 89 | <i class="fas fa-trophy fa-lg text-warning"></i> |
90 | 90 | {% else %} |
91 | - <span class="text-nowrap"> | |
92 | - {{ round(t['level']*5)*'<i class="fas fa-star text-warning"></i>' + round(5-t['level']*5)*'<i class="far fa-star text-warning"></i>' }} | |
93 | - </span> | |
91 | + <span class="text-nowrap"> | |
92 | + {{ round(t['level']*5)*'<i class="fas fa-star text-warning"></i>' + (5-round(t['level']*5))*'<i class="far fa-star text-warning"></i>' }} | |
93 | + </span> | |
94 | 94 | {% end %} |
95 | 95 | {% end %} |
96 | 96 | </div> | ... | ... |