Commit 80851f815e8db51c175048fa43ac7a99d110b6e2

Authored by Miguel Barão
1 parent 4f21e22a
Exists in master and in 1 other branch dev

- calculate stars based on the number of correct/wrong answers

Showing 2 changed files with 11 additions and 4 deletions   Show diff stats
BUGS.md
1 1  
2 2 BUGS:
3 3  
  4 +- level depender do numero de respostas correctas
4 5 - pymips: activar/desactivar instruções
5 6 - tabs em textarea nao funcionam correctamente (insere 1 espaco em vez de 4)
6 7 - reportar comentarios após submeter.
... ...
knowledge.py
... ... @@ -32,7 +32,7 @@ class Knowledge(object):
32 32 if topic is None:
33 33 # select the first topic that has level < 0.9
34 34 for topic in self.topic_sequence:
35   - if topic not in self.state or self.state[topic]['level'] < 0.9:
  35 + if topic not in self.state or self.state[topic]['level'] < 0.8:
36 36 break
37 37 logger.debug(f'Student {self.student}: new_topic({topic})')
38 38  
... ... @@ -42,6 +42,8 @@ class Knowledge(object):
42 42 self.questions = self.generate_questions_for_topic(topic)
43 43 self.current_question = None
44 44 self.finished_questions = []
  45 + self.correct_answers = 1
  46 + self.wrong_answers = 0
45 47  
46 48 # ------------------------------------------------------------------------
47 49 def generate_questions_for_topic(self, topic):
... ... @@ -85,7 +87,7 @@ class Knowledge(object):
85 87 # keep going if there are no questions in the next topics
86 88 while not self.questions:
87 89 self.state[self.current_topic] = {
88   - 'level': 1.0, # FIXME depends on how many are correct
  90 + 'level': self.correct_answers / (self.correct_answers + self.wrong_answers),
89 91 'date': datetime.now()
90 92 }
91 93 self.new_topic()
... ... @@ -103,8 +105,12 @@ class Knowledge(object):
103 105 question = self.current_question
104 106 if question is not None:
105 107 question['finish_time'] = datetime.now()
106   - question.correct(answer)
  108 + grade = question.correct(answer)
  109 + if grade > 0.9:
  110 + self.correct_answers += 1
  111 + else:
  112 + self.wrong_answers +=1
107 113  
108   - logger.debug(f'Student {self.student}: check_answer({answer}) = {question["grade"]}')
  114 + logger.debug(f'Student {self.student}: check_answer({answer}) = {grade}')
109 115  
110 116 return question
... ...