diff --git a/BUGS.md b/BUGS.md
index e0ea521..f2b4c3f 100644
--- a/BUGS.md
+++ b/BUGS.md
@@ -1,7 +1,12 @@
BUGS:
-- change password in maintopics.html, falta menu para lançar modal
+- indentação da primeira linha de código não funciona.
+- submeter questoes radio, da erro se nao escolher nenhuma opção.
+- gravar evolucao na bd no final de cada topico.
+- servir imagens/ficheiros.
+- topicos virtuais nao deveriam aparecer. na construção da árvore os sucessores seriam ligados directamente aos predecessores.
+
- reportar comentarios após submeter.
- cada topico tem uma pagina begin e uma end
@@ -26,6 +31,8 @@ TODO:
FIXED:
+- markdown com o mistune.
+- change password in maintopics.html, falta menu para lançar modal
- ver documentacao de migracao para networkx 2.0 https://networkx.github.io/documentation/stable/release/migration_guide_from_1.x_to_2.0.html
- script para adicionar users/reset passwords.
- os topicos locked devem estar inactivos no sidebar.
diff --git a/demo/demo.yaml b/demo/demo.yaml
index 85e05b6..9e8158e 100644
--- a/demo/demo.yaml
+++ b/demo/demo.yaml
@@ -19,6 +19,6 @@ topics:
# topic with one dependency
solar_system:
- name: Solar system
+ name: Sistema solar
deps:
- math
diff --git a/knowledge.py b/knowledge.py
index af0090f..0996597 100644
--- a/knowledge.py
+++ b/knowledge.py
@@ -37,6 +37,7 @@ class StudentKnowledge(object):
# compute recommended sequence of topics ['a', 'b', ...]
self.topic_sequence = list(nx.topological_sort(self.deps))
+ self.unlock_topics()
# ------------------------------------------------------------------------
# Unlock topics whose dependencies are satisfied (> min_level)
@@ -90,7 +91,6 @@ class StudentKnowledge(object):
if not topic:
topic = self.recommended_topic()
- print(f'recommended {topic}')
self.current_topic = topic
logger.info(f'Topic set to "{topic}"')
@@ -112,10 +112,17 @@ class StudentKnowledge(object):
logger.debug('StudentKnowledge.check_answer()')
q = self.current_question
+
+ # answers are returned from tornado in a list
+ if q['type'] in ('success', 'information', 'info'): # FIXME danger...
+ q['answer'] = None
+ elif q['type'] != 'checkbox':
+ q['answer'] = answer[0]
+ else:
+ q['answer'] = answer
+
q['finish_time'] = datetime.now()
- q['answer'] = answer
grade = q.correct()
-
logger.debug(f'Grade = {grade:.2} ({q["ref"]})')
# if answer is correct, get next question
@@ -124,17 +131,18 @@ class StudentKnowledge(object):
try:
self.current_question = self.questions.pop(0) # FIXME empty?
except IndexError:
+ # finished topic, no more questions
self.current_question = None
self.state[self.current_topic] = {
'level': 1.0,
'date': datetime.now()
}
+ self.unlock_topics()
else:
self.current_question['start_time'] = datetime.now()
# if answer is wrong, keep same question and add a similar one at the end
else:
- print('failed')
factory = self.deps.node[self.current_topic]['factory']
self.questions.append(factory[q['ref']].generate())
diff --git a/serve.py b/serve.py
index c6ed112..2d60410 100755
--- a/serve.py
+++ b/serve.py
@@ -19,7 +19,7 @@ from tornado import template, gen
# this project
from learnapp import LearnApp
-from tools import load_yaml, md
+from tools import load_yaml, md_to_html
# ============================================================================
@@ -30,11 +30,11 @@ class WebApplication(tornado.web.Application):
handlers = [
(r'/login', LoginHandler),
(r'/logout', LogoutHandler),
- # (r'/change_password', ChangePasswordHandler),
+ (r'/change_password', ChangePasswordHandler),
(r'/question', QuestionHandler), # each question
(r'/topic/(.+)', TopicHandler), # page for doing a topic
(r'/', RootHandler), # show list of topics
- # (r'/(.+)', FileHandler),
+ # (r'/file/(.+)', FileHandler),
]
settings = {
'template_path': path.join(path.dirname(__file__), 'templates'),
@@ -174,13 +174,9 @@ class QuestionHandler(BaseHandler):
}
def new_question(self, user):
- logger.debug(f'new_question({user})')
- # state = self.learn.get_student_state(user) # [{ref, name, level},...]
- # current_topic = self.learn.get_student_topic(user) # str
-
question = self.learn.get_student_question(user) # Question
template = self.templates[question['type']]
- question_html = self.render_string(template, question=question, md=md)
+ question_html = self.render_string(template, question=question, md=md_to_html)
return {
'method': 'new_question',
@@ -191,7 +187,6 @@ class QuestionHandler(BaseHandler):
}
def wrong_answer(self, user):
- logger.debug(f'wrong_answer({user})')
progress = self.learn.get_student_progress(user) # in the current topic
return {
'method': 'shake',
@@ -200,17 +195,12 @@ class QuestionHandler(BaseHandler):
}
}
- def finished_topic(self, user):
- logger.debug(f'finished_topic({user})')
-
- # state = self.learn.get_student_state(user) # all topics
- # current_topic = self.learn.get_student_topic(uid)
-
+ def finished_topic(self, user): # FIXME user unused
return {
'method': 'finished_topic',
'params': {
- 'question': '',
- 'progress': 1.0,
+ 'question': f'
',
+ # 'progress': 1.0,
}
}
@@ -221,7 +211,7 @@ class QuestionHandler(BaseHandler):
question = self.learn.get_student_question(user)
template = self.templates[question['type']]
- question_html = self.render_string(template, question=question, md=md)
+ question_html = self.render_string(template, question=question, md=md_to_html)
self.write({
'method': 'new_question',
@@ -237,12 +227,9 @@ class QuestionHandler(BaseHandler):
logging.debug('QuestionHandler.post()')
user = self.current_user
- print(self.get_body_arguments())
- # if self.learn.get_student_question(user) is None:
-
- answer = self.get_body_argument('answer')
-
# check answer and get next question (same, new or None)
+ answer = self.get_body_arguments('answer') # list
+ print(answer)
grade = self.learn.check_answer(user, answer)
question = self.learn.get_student_question(user)
diff --git a/templates/maintopics.html b/templates/maintopics.html
index 9b75deb..9a2eb44 100644
--- a/templates/maintopics.html
+++ b/templates/maintopics.html
@@ -35,17 +35,26 @@
-