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