diff --git a/BUGS.md b/BUGS.md index 48d690f..f809df9 100644 --- a/BUGS.md +++ b/BUGS.md @@ -1,8 +1,8 @@ # BUGS +- double click submits twice. - nao esta a seguir o max_tries definido no ficheiro de dependencias. -- no curso de linear algebra, as perguntas estao shuffled, mas nao deviam estar... nao esta a obedecer a keyword shuffle. - obter rankings por curso GET course=course_id - impedir que quando students.db não é encontrado, crie um ficheiro vazio. - classificacoes so devia mostrar os que ja fizeram alguma coisa @@ -48,6 +48,7 @@ sqlite3.ProgrammingError: SQLite objects created in a thread can only be used in # FIXED +- no curso de linear algebra, as perguntas estao shuffled, mas nao deviam estar... nao esta a obedecer a keyword shuffle. - menu nao mostra as opcoes correctamente - finish topic vai para a lista de cursos. devia ficar no mesmo curso. - mathjax nao esta a correr sobre o titulo. diff --git a/aprendizations/static/js/topic.js b/aprendizations/static/js/topic.js index 8c34cec..7acd2e3 100644 --- a/aprendizations/static/js/topic.js +++ b/aprendizations/static/js/topic.js @@ -9,27 +9,19 @@ $.fn.extend({ }); function showTriesLeft(tries) { - var tries_msg; - - switch (tries) { - case 0: - tries_msg = ""; - break; - case 1: - tries_msg = "(1 tentativa)"; - break; - default: - tries_msg = "(" + tries + " tentativas)"; - } - - $("#tries").html(tries_msg); + var msg; + if (tries > 1) + msg = "(" + tries + " tentativas)"; + else if (tries == 1) + msg = "(1 tentativa)"; + else + msg = ""; + $("#tries").html(msg); } - // Get current question function getQuestion() { $("#submit").addClass("disabled"); - $.ajax({ type: "GET", url: "/question", @@ -39,14 +31,12 @@ function getQuestion() { }); } - -// updates question according to the response given by the server +// updates question in the page according to the response given by the server function updateQuestion(response) { var method = response["method"]; var params = response["params"]; $("#right, #wrong").hide(); - switch (method) { case "new_question": new_question(params["type"], params["question"], params["tries"], params["progress"]); @@ -60,12 +50,11 @@ function updateQuestion(response) { } } - function new_question(type, question, tries, progress) { window.scrollTo(0, 0); $("#question_div").html(question).animateCSS('bounceInDown'); showTriesLeft(tries); - $("#comments, #solution").html(""); + $("#comments").html("").hide(); var btntext = (type == "information") ? "Continuar" : "Responder"; $("#submit").html(btntext).off().click(postAnswer); $('#topic_progress').css('width', (100*progress)+'%').attr('aria-valuenow', 100*progress); @@ -75,24 +64,14 @@ function new_question(type, question, tries, progress) { $(".list-group-item").click(function (e) { var index = $(this).index(); $("div.list-group input:radio").eq(index).prop("checked", true); - - // $('a.list-group-item-primary').removeClass('list-group-item-primary'); - // $(this).addClass('list-group-item-primary'); }); } - // else if (type == "checkbox") { - // $(".list-group-item").click(function () { - // $("input:checkbox", this).trigger("click"); - // }); - // } - - // enable shift+enter to submit - $("input:text, input:radio, input:checkbox").keydown(function (e) { - if (e.keyCode == 13) { - e.preventDefault(); - // if (e.shiftKey) { - // $("#submit").click(); - // } + + // prevent enter submit. + //input:text, input:radio, input:checkbox + $("body").keyup(function (e) { + if (e.keyCode == 13 && e.shiftKey) { + $("#submit").click(); return false; }}); } @@ -127,43 +106,30 @@ function getFeedback(response) { switch (method) { case "right": - $('#right').show(); - $('#wrong').hide(); - $('#comments').html(params['comments']); + $('#comments').html(params['comments']).show(); + $('#solution_right').html(params['solution']); MathJax.typeset(); - + $('#wrong').hide(); + $('#right').show().animateCSS('flipInX'); $("#submit").html("Continuar").off().click(getQuestion); - $("#link_solution_on_right").click(function(){ - $("#right").hide(); - $('#solution').html(params['solution']).animateCSS('flipInX'); - // MathJax.Hub.Queue(["Typeset", MathJax.Hub, "#solution"]); - MathJax.typeset(); - - }); break; case "try_again": + $('#comments').html(params['comments']).show(); + MathJax.typeset(); $('#question_div').animateCSS('shake'); $('#topic_progress').css('width', (100*params["progress"])+'%').attr('aria-valuenow', 100*params["progress"]); showTriesLeft(params["tries"]); - $('#comments').html(params['comments']); - MathJax.typeset(); break; case "wrong": + $('#comments').html(params['comments']).show(); + $('#solution_wrong').html(params['solution']); + MathJax.typeset(); $('#right').hide(); - $('#wrong').show(); + $('#wrong').show().animateCSS('flipInX'); $('#topic_progress').css('width', (100*params["progress"])+'%').attr('aria-valuenow', 100*params["progress"]); showTriesLeft(params["tries"]); - $('#comments').html(params['comments']); - // MathJax.typeset(); - MathJax.typeset(); - $("#link_solution_on_wrong").click(function () { - $("#wrong").hide(); - $('#solution').html(params['solution']).animateCSS('flipInX'); - // MathJax.Hub.Queue(["Typeset", MathJax.Hub, "#solution"]); - MathJax.typeset(); - }); $("fieldset").attr("disabled", "disabled"); $("#submit").html("Continuar").off().click(getQuestion); break; diff --git a/aprendizations/templates/solution.html b/aprendizations/templates/solution.html index c8b1a71..fed4a6e 100644 --- a/aprendizations/templates/solution.html +++ b/aprendizations/templates/solution.html @@ -3,7 +3,6 @@ {% if solution %}
-

Solução

{{ md(solution) }}
diff --git a/aprendizations/templates/topic.html b/aprendizations/templates/topic.html index 327c772..792d951 100644 --- a/aprendizations/templates/topic.html +++ b/aprendizations/templates/topic.html @@ -92,30 +92,18 @@ -
- -- libgit2 0.21.2