Commit 7cccde35cfcd71c38d060a0872dad64f1ec290b6
1 parent
9fea0977
Exists in
master
and in
1 other branch
- changed max_questions to 6 and moved as parameter
Showing
1 changed file
with
4 additions
and
2 deletions
Show diff stats
knowledge.py
| @@ -31,6 +31,7 @@ class StudentKnowledge(object): | @@ -31,6 +31,7 @@ class StudentKnowledge(object): | ||
| 31 | self.topic_sequence = self.recommend_topic_sequence() # ['a', 'b', ...] | 31 | self.topic_sequence = self.recommend_topic_sequence() # ['a', 'b', ...] |
| 32 | self.unlock_topics() | 32 | self.unlock_topics() |
| 33 | 33 | ||
| 34 | + self.MAX_QUESTIONS = 6 # FIXME get from configuration file?? | ||
| 34 | 35 | ||
| 35 | # ------------------------------------------------------------------------ | 36 | # ------------------------------------------------------------------------ |
| 36 | # Updates the proficiency levels of the topics, with forgetting factor | 37 | # Updates the proficiency levels of the topics, with forgetting factor |
| @@ -88,7 +89,8 @@ class StudentKnowledge(object): | @@ -88,7 +89,8 @@ class StudentKnowledge(object): | ||
| 88 | self.wrong_answers = 0 | 89 | self.wrong_answers = 0 |
| 89 | self.finished_questions = [] | 90 | self.finished_questions = [] |
| 90 | 91 | ||
| 91 | - questionlist = random.sample(questionlist, k=min(8, len(questionlist))) # FIXME make 8 a configuration parameter | 92 | + size = min(self.MAX_QUESTIONS, len(questionlist)) # number of questions |
| 93 | + questionlist = random.sample(questionlist, k=size) | ||
| 92 | 94 | ||
| 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') |
| @@ -133,7 +135,7 @@ class StudentKnowledge(object): | @@ -133,7 +135,7 @@ class StudentKnowledge(object): | ||
| 133 | grade = q.correct() | 135 | grade = q.correct() |
| 134 | logger.debug(f'Grade = {grade:.2} ({q["ref"]})') | 136 | logger.debug(f'Grade = {grade:.2} ({q["ref"]})') |
| 135 | 137 | ||
| 136 | - self.finished_questions.append(q) # both correct and wrong answers | 138 | + self.finished_questions.append(q) # both correct and wrong answers |
| 137 | 139 | ||
| 138 | # if answer is correct, get next question | 140 | # if answer is correct, get next question |
| 139 | if grade > 0.999: | 141 | if grade > 0.999: |