Commit 7cccde35cfcd71c38d060a0872dad64f1ec290b6

Authored by Miguel Barão
1 parent 9fea0977
Exists in master and in 1 other branch dev

- 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 31 self.topic_sequence = self.recommend_topic_sequence() # ['a', 'b', ...]
32 32 self.unlock_topics()
33 33  
  34 + self.MAX_QUESTIONS = 6 # FIXME get from configuration file??
34 35  
35 36 # ------------------------------------------------------------------------
36 37 # Updates the proficiency levels of the topics, with forgetting factor
... ... @@ -88,7 +89,8 @@ class StudentKnowledge(object):
88 89 self.wrong_answers = 0
89 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 95 self.questions = [factory[qref].generate() for qref in questionlist]
94 96 logger.debug(f'Total: {len(self.questions)} questions')
... ... @@ -133,7 +135,7 @@ class StudentKnowledge(object):
133 135 grade = q.correct()
134 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 140 # if answer is correct, get next question
139 141 if grade > 0.999:
... ...