Commit e20125b8f9839180e31ebd7e4e126a7bb27627a2

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

- minor adjustments in looks and logs

1 1
2 # BUGS 2 # BUGS
3 3
  4 +- on start topic, logs show questionhandler.get() twice.
4 - generators e correct scripts que durem muito tempo podem bloquear o loop do tornado? 5 - generators e correct scripts que durem muito tempo podem bloquear o loop do tornado?
5 - detect questions in questions.yaml without ref -> error ou generate default. 6 - detect questions in questions.yaml without ref -> error ou generate default.
6 -- topicos virtuais nao deveriam aparecer. na construção da árvore os sucessores seriam ligados directamente aos predecessores.  
7 - Criar outra estrutura organizada em capítulos (conjuntos de tópicos). Permitir capítulos de capítulos, etc. talvez usar grafos de grafos... 7 - Criar outra estrutura organizada em capítulos (conjuntos de tópicos). Permitir capítulos de capítulos, etc. talvez usar grafos de grafos...
8 - session management. close after inactive time. 8 - session management. close after inactive time.
9 - generators not working: bcrypt (ver blog) 9 - generators not working: bcrypt (ver blog)
@@ -11,6 +11,7 @@ @@ -11,6 +11,7 @@
11 11
12 # TODO 12 # TODO
13 13
  14 +- radio e checkboxes, aceitar numeros como seleccao das opcoes.
14 - each topic only loads a sample of K questions (max) in random order. 15 - each topic only loads a sample of K questions (max) in random order.
15 - servir imagens/ficheiros. 16 - servir imagens/ficheiros.
16 - pertuntas tipo tristate: (sim, não, não sei 17 - pertuntas tipo tristate: (sim, não, não sei
@@ -54,7 +54,7 @@ class StudentKnowledge(object): @@ -54,7 +54,7 @@ class StudentKnowledge(object):
54 def unlock_topics(self): 54 def unlock_topics(self):
55 # minimum level that the dependencies of a topic must have 55 # minimum level that the dependencies of a topic must have
56 # for the topic to be unlocked. 56 # for the topic to be unlocked.
57 - min_level = 0.2 57 + min_level = 0.01
58 58
59 for topic in self.topic_sequence: 59 for topic in self.topic_sequence:
60 if topic not in self.state: # if locked 60 if topic not in self.state: # if locked
@@ -89,8 +89,9 @@ class StudentKnowledge(object): @@ -89,8 +89,9 @@ 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.questions = [factory[qref].generate() for qref in questionlist]  
93 self.finished_questions = [] 92 self.finished_questions = []
  93 + self.questions = [factory[qref].generate() for qref in questionlist]
  94 + logger.debug(f'Total: {len(self.questions)} questions')
94 95
95 try: 96 try:
96 self.current_question = self.questions.pop(0) # FIXME crash if empty 97 self.current_question = self.questions.pop(0) # FIXME crash if empty
@@ -58,6 +58,8 @@ class LearnApp(object): @@ -58,6 +58,8 @@ class LearnApp(object):
58 if bcrypt.checkpw(pw.encode('utf-8'), student.password): 58 if bcrypt.checkpw(pw.encode('utf-8'), student.password):
59 if uid in self.online: 59 if uid in self.online:
60 logger.warning(f'User "{uid}" already logged in, overwriting state') 60 logger.warning(f'User "{uid}" already logged in, overwriting state')
  61 + else:
  62 + logger.info(f'User "{uid}" logged in successfully')
61 63
62 tt = s.query(StudentTopic).filter(StudentTopic.student_id == uid) 64 tt = s.query(StudentTopic).filter(StudentTopic.student_id == uid)
63 state = {t.topic_id: 65 state = {t.topic_id:
@@ -71,7 +73,6 @@ class LearnApp(object): @@ -71,7 +73,6 @@ class LearnApp(object):
71 'name': student.name, 73 'name': student.name,
72 'state': StudentKnowledge(self.deps, state=state) 74 'state': StudentKnowledge(self.deps, state=state)
73 } 75 }
74 - logger.info(f'User "{uid}" logged in successfully')  
75 return True 76 return True
76 77
77 else: 78 else:
static/css/topic.css
1 .progress { 1 .progress {
2 /*position: fixed;*/ 2 /*position: fixed;*/
3 top: 0; 3 top: 0;
4 - height: 90px; 4 + height: 85px;
5 border-radius: 0px; 5 border-radius: 0px;
6 } 6 }
7 body { 7 body {
8 margin: 0; 8 margin: 0;
9 padding-top: 0px; 9 padding-top: 0px;
10 - margin-bottom: 90px; /* Margin bottom by footer height */ 10 + margin-bottom: 120px; /* Margin bottom by footer height */
11 } 11 }
12 12
13 .footer { 13 .footer {
14 position: absolute; 14 position: absolute;
15 bottom: 0; 15 bottom: 0;
16 width: 100%; 16 width: 100%;
17 - height: 70px; 17 + height: 90px;
18 line-height: 60px; 18 line-height: 60px;
19 /*background-color: #f5f5f5;*/ 19 /*background-color: #f5f5f5;*/
20 } 20 }