Commit 0153d41a74c4a3dd34684dd2318e53b9e066f7b5

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

- fixed inactivate input on submit (also double clicks)

- changed animations and shows a spinner while correcting
BUGS.md
1 1  
2 2 # BUGS
3 3  
4   -- apos clicar no botao responder, inactivar o input (importante quando o tempo de correcção é grande)
5 4 - nao esta a seguir o max_tries definido no ficheiro de dependencias.
6   -- initdb da integrity error se no mesmo comando existirem alunos repetidos (p.ex em ficheiros csv diferentes ou entre csv e opcao -a)
7   -- double click submits twice.
8   -- duplo clicks no botao "responder" dessincroniza as questões, ver debounce em https://stackoverflow.com/questions/20281546/how-to-prevent-calling-of-en-event-handler-twice-on-fast-clicks
9 5 - devia mostrar timeout para o aluno saber a razao.
10 6 - permitir configuracao para escolher entre static files locais ou remotos
11 7 - templates question-*.html tem input hidden question_ref que não é usado. remover?
12 8 - shift-enter não está a funcionar
13 9 - default prefix should be obtained from each course (yaml conf)?
  10 +- initdb da integrity error se no mesmo comando existirem alunos repetidos (p.ex em ficheiros csv diferentes ou entre csv e opcao -a)
14 11  
15 12 # TODO
16 13  
... ... @@ -34,6 +31,8 @@
34 31  
35 32 # FIXED
36 33  
  34 +- apos clicar no botao responder, inactivar o input (importante quando o tempo de correcção é grande)
  35 +- double click submits twice.
37 36 - checkbox devia ter correct no intervalo [0,1] tal como radio. em caso de desconto a correccção faz 2*x-1. isto permite a mesma semantica nos dois tipos de perguntas.
38 37 - marking all options right in a radio question breaks!
39 38 - implementar servidor http com redirect para https.
... ...
aprendizations/questions.py
... ... @@ -220,11 +220,11 @@ class QuestionCheckbox(Question):
220 220 if self['discount'] and not all(0.0 <= x <= 1.0
221 221 for x in self['correct']):
222 222  
223   - msg0 = ('+-------------- BEHAVIOR CHANGE NOTICE --------------+')
224   - msg1 = ('| Correct values must be in the interval [0.0, 1.0]. |')
225   - msg2 = ('| I will convert to the new behavior, but you should |')
226   - msg3 = ('| fix it in the question. |')
227   - msg4 = ('+----------------------------------------------------+')
  223 + msg0 = ('+--------------- BEHAVIOR CHANGE NOTICE ---------------+')
  224 + msg1 = ('| Correct values in checkbox questions must be in the |')
  225 + msg2 = ('| interval [0.0, 1.0]. I will convert to the new |')
  226 + msg3 = ('| behavior, for now, but you should fix it. |')
  227 + msg4 = ('+------------------------------------------------------+')
228 228 logger.warning(msg0)
229 229 logger.warning(msg1)
230 230 logger.warning(msg2)
... ...
aprendizations/serve.py
... ... @@ -345,7 +345,7 @@ class QuestionHandler(BaseHandler):
345 345 return
346 346  
347 347 # --- brain hacking ;)
348   - await asyncio.sleep(2)
  348 + await asyncio.sleep(1.5)
349 349  
350 350 # --- answers are in a list. fix depending on question type
351 351 qtype = self.learn.get_student_question_type(user)
... ...
aprendizations/static/js/topic.js
... ... @@ -13,7 +13,7 @@ function showTriesLeft(tries) {
13 13 if (tries > 1)
14 14 msg = "(" + tries + " tentativas)";
15 15 else if (tries == 1)
16   - msg = "(1 tentativa)";
  16 + msg = "(última tentativa)";
17 17 else
18 18 msg = "";
19 19 $("#tries").html(msg);
... ... @@ -93,6 +93,8 @@ function postAnswer() {
93 93 success: getFeedback,
94 94 error: function() {alert("O servidor não responde.");}
95 95 });
  96 + $("#submit").addClass("disabled").html('<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>');
  97 + $("fieldset").prop("disabled", true);
96 98 }
97 99  
98 100 function getFeedback(response) {
... ... @@ -110,7 +112,7 @@ function getFeedback(response) {
110 112 $('#solution_right').html(params['solution']);
111 113 MathJax.typeset();
112 114 $('#wrong').hide();
113   - $('#right').show().animateCSS('flipInX');
  115 + $('#right').show().animateCSS('zoomIn');
114 116 $("#submit").html("Continuar").off().click(getQuestion);
115 117 break;
116 118  
... ... @@ -120,6 +122,8 @@ function getFeedback(response) {
120 122 $('#question_div').animateCSS('shake');
121 123 $('#topic_progress').css('width', (100*params["progress"])+'%').attr('aria-valuenow', 100*params["progress"]);
122 124 showTriesLeft(params["tries"]);
  125 + $("fieldset").prop("disabled", false);
  126 + $("#submit").html("Responder");
123 127 break;
124 128  
125 129 case "wrong":
... ... @@ -127,10 +131,11 @@ function getFeedback(response) {
127 131 $('#solution_wrong').html(params['solution']);
128 132 MathJax.typeset();
129 133 $('#right').hide();
130   - $('#wrong').show().animateCSS('flipInX');
  134 + $('#wrong').show(); //.animateCSS('zoomIn');
131 135 $('#topic_progress').css('width', (100*params["progress"])+'%').attr('aria-valuenow', 100*params["progress"]);
132 136 showTriesLeft(params["tries"]);
133   - $("fieldset").attr("disabled", "disabled");
  137 + $("fieldset").prop("disabled", true);
  138 + $('#question_div').animateCSS('shake');
134 139 $("#submit").html("Continuar").off().click(getQuestion);
135 140 break;
136 141  
... ...
package-lock.json
... ... @@ -40,9 +40,9 @@
40 40 }
41 41 },
42 42 "mdbootstrap": {
43   - "version": "4.9.0",
44   - "resolved": "https://registry.npmjs.org/mdbootstrap/-/mdbootstrap-4.9.0.tgz",
45   - "integrity": "sha512-6R3j5D9Qmp+Aa90FblOVAwVDSqpAICYW2dpNxh6uaVB9E9MCaBLdaTKLrXCB7xznReHEaA57pNABXgFoi2z7Rg=="
  43 + "version": "4.10.0",
  44 + "resolved": "https://registry.npmjs.org/mdbootstrap/-/mdbootstrap-4.10.0.tgz",
  45 + "integrity": "sha512-jpDSrAv9BbqHGFCHf9iQts7dWAuJYT3VFmElLkKpD6cGJ5Pcjv5oiTvfKvFGjVsxWsjLtj7Y0Rh135EYejkaeg=="
46 46 },
47 47 "mj-context-menu": {
48 48 "version": "0.2.0",
... ...
package.json
... ... @@ -5,7 +5,7 @@
5 5 "@fortawesome/fontawesome-free": "^5.11.2",
6 6 "codemirror": "^5.49.2",
7 7 "mathjax": "^3",
8   - "mdbootstrap": "^4.9.0"
  8 + "mdbootstrap": "^4.10.0"
9 9 },
10 10 "private": true
11 11 }
... ...