diff --git a/BUGS.md b/BUGS.md index 1ccddc8..95acdf2 100644 --- a/BUGS.md +++ b/BUGS.md @@ -1,6 +1,7 @@ # BUGS +- generators e correct scripts que durem muito tempo podem bloquear o loop do tornado? - detect questions in questions.yaml without ref -> error ou generate default. - topicos virtuais nao deveriam aparecer. na construção da árvore os sucessores seriam ligados directamente aos predecessores. - Criar outra estrutura organizada em capítulos (conjuntos de tópicos). Permitir capítulos de capítulos, etc. talvez usar grafos de grafos... @@ -11,7 +12,6 @@ # TODO -- update de fontawesome para versão 5. - reportar comentarios após submeter. - each topic only loads a sample of K questions (max) in random order. - servir imagens/ficheiros. @@ -31,6 +31,7 @@ # FIXED +- update de fontawesome para versão 5.0.6. - remover learn.css uma vez que nao é usado em lado nenhum? - check if user already logged in - mover javascript para ficheiros externos e carregar com script defer src diff --git a/learnapp.py b/learnapp.py index d750220..474442c 100644 --- a/learnapp.py +++ b/learnapp.py @@ -267,9 +267,11 @@ class LearnApp(object): # g.node['my/topic']['name'] name of the topic # g.node['my/topic']['questions'] list of question refs defined in YAML # g.node['my/topic']['factory'] dict with question factories +# +# Edges are obtained from the deps defined in the YAML file for each topic. # ---------------------------------------------------------------------------- def build_dependency_graph(config={}): - logger.info('Building topic dependency graph.') + logger.info('Building graph and loading questions:') # create graph prefix = config.get('path', '.') @@ -281,18 +283,15 @@ def build_dependency_graph(config={}): topics = config.get('topics', {}) for ref,attr in topics.items(): g.add_node(ref) + tnode = g.node[ref] # current node (topic) + if isinstance(attr, dict): - g.node[ref]['name'] = attr.get('name', ref) - g.node[ref]['questions'] = attr.get('questions', []) + tnode['name'] = attr.get('name', ref) + tnode['questions'] = attr.get('questions', []) g.add_edges_from((d,ref) for d in attr.get('deps', [])) - # iterate over topics and create question factories - logger.info('Loading:') - for tref in g.nodes(): - tnode = g.node[tref] # current node (topic) - fullpath = path.expanduser(path.join(prefix, tref)) + fullpath = path.expanduser(path.join(prefix, ref)) filename = path.join(fullpath, 'questions.yaml') - loaded_questions = load_yaml(filename, default=[]) # list # if questions not in configuration then load all, preserving order @@ -303,9 +302,9 @@ def build_dependency_graph(config={}): tnode['factory'] = {} for q in loaded_questions: if q['ref'] in tnode['questions']: - q['path'] = fullpath + q['path'] = fullpath # fullpath added to each question tnode['factory'][q['ref']] = QFactory(q) - logger.info(f'{len(tnode["questions"]):6} from {tref}') + logger.info(f'{len(tnode["questions"]):6} from {ref}') return g diff --git a/static/js/maintopics.js b/static/js/maintopics.js index b323c14..284120c 100644 --- a/static/js/maintopics.js +++ b/static/js/maintopics.js @@ -1,6 +1,6 @@ function notify(msg) { $("#notifications").html(msg); - $("#notifications").fadeIn(250).delay(5000).fadeOut(500); + $("#notifications").fadeIn(250).delay(3000).fadeOut(500); } function getCookie(name) { @@ -9,6 +9,8 @@ function getCookie(name) { } function change_password() { + // alert('hello'); + // notify('hello!'); var token = getCookie('_xsrf'); $.ajax({ type: "POST", diff --git a/templates/notification.html b/templates/notification.html index 99c69e9..1019596 100644 --- a/templates/notification.html +++ b/templates/notification.html @@ -1,7 +1,4 @@ - -