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
1 1
2 # BUGS 2 # BUGS
3 3
4 -- apos clicar no botao responder, inactivar o input (importante quando o tempo de correcção é grande)  
5 - nao esta a seguir o max_tries definido no ficheiro de dependencias. 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 - devia mostrar timeout para o aluno saber a razao. 5 - devia mostrar timeout para o aluno saber a razao.
10 - permitir configuracao para escolher entre static files locais ou remotos 6 - permitir configuracao para escolher entre static files locais ou remotos
11 - templates question-*.html tem input hidden question_ref que não é usado. remover? 7 - templates question-*.html tem input hidden question_ref que não é usado. remover?
12 - shift-enter não está a funcionar 8 - shift-enter não está a funcionar
13 - default prefix should be obtained from each course (yaml conf)? 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 # TODO 12 # TODO
16 13
@@ -34,6 +31,8 @@ @@ -34,6 +31,8 @@
34 31
35 # FIXED 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 - 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. 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 - marking all options right in a radio question breaks! 37 - marking all options right in a radio question breaks!
39 - implementar servidor http com redirect para https. 38 - implementar servidor http com redirect para https.
aprendizations/questions.py
@@ -220,11 +220,11 @@ class QuestionCheckbox(Question): @@ -220,11 +220,11 @@ class QuestionCheckbox(Question):
220 if self['discount'] and not all(0.0 <= x <= 1.0 220 if self['discount'] and not all(0.0 <= x <= 1.0
221 for x in self['correct']): 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 logger.warning(msg0) 228 logger.warning(msg0)
229 logger.warning(msg1) 229 logger.warning(msg1)
230 logger.warning(msg2) 230 logger.warning(msg2)
aprendizations/serve.py
@@ -345,7 +345,7 @@ class QuestionHandler(BaseHandler): @@ -345,7 +345,7 @@ class QuestionHandler(BaseHandler):
345 return 345 return
346 346
347 # --- brain hacking ;) 347 # --- brain hacking ;)
348 - await asyncio.sleep(2) 348 + await asyncio.sleep(1.5)
349 349
350 # --- answers are in a list. fix depending on question type 350 # --- answers are in a list. fix depending on question type
351 qtype = self.learn.get_student_question_type(user) 351 qtype = self.learn.get_student_question_type(user)
aprendizations/static/js/topic.js
@@ -13,7 +13,7 @@ function showTriesLeft(tries) { @@ -13,7 +13,7 @@ function showTriesLeft(tries) {
13 if (tries > 1) 13 if (tries > 1)
14 msg = "(" + tries + " tentativas)"; 14 msg = "(" + tries + " tentativas)";
15 else if (tries == 1) 15 else if (tries == 1)
16 - msg = "(1 tentativa)"; 16 + msg = "(última tentativa)";
17 else 17 else
18 msg = ""; 18 msg = "";
19 $("#tries").html(msg); 19 $("#tries").html(msg);
@@ -93,6 +93,8 @@ function postAnswer() { @@ -93,6 +93,8 @@ function postAnswer() {
93 success: getFeedback, 93 success: getFeedback,
94 error: function() {alert("O servidor não responde.");} 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 function getFeedback(response) { 100 function getFeedback(response) {
@@ -110,7 +112,7 @@ function getFeedback(response) { @@ -110,7 +112,7 @@ function getFeedback(response) {
110 $('#solution_right').html(params['solution']); 112 $('#solution_right').html(params['solution']);
111 MathJax.typeset(); 113 MathJax.typeset();
112 $('#wrong').hide(); 114 $('#wrong').hide();
113 - $('#right').show().animateCSS('flipInX'); 115 + $('#right').show().animateCSS('zoomIn');
114 $("#submit").html("Continuar").off().click(getQuestion); 116 $("#submit").html("Continuar").off().click(getQuestion);
115 break; 117 break;
116 118
@@ -120,6 +122,8 @@ function getFeedback(response) { @@ -120,6 +122,8 @@ function getFeedback(response) {
120 $('#question_div').animateCSS('shake'); 122 $('#question_div').animateCSS('shake');
121 $('#topic_progress').css('width', (100*params["progress"])+'%').attr('aria-valuenow', 100*params["progress"]); 123 $('#topic_progress').css('width', (100*params["progress"])+'%').attr('aria-valuenow', 100*params["progress"]);
122 showTriesLeft(params["tries"]); 124 showTriesLeft(params["tries"]);
  125 + $("fieldset").prop("disabled", false);
  126 + $("#submit").html("Responder");
123 break; 127 break;
124 128
125 case "wrong": 129 case "wrong":
@@ -127,10 +131,11 @@ function getFeedback(response) { @@ -127,10 +131,11 @@ function getFeedback(response) {
127 $('#solution_wrong').html(params['solution']); 131 $('#solution_wrong').html(params['solution']);
128 MathJax.typeset(); 132 MathJax.typeset();
129 $('#right').hide(); 133 $('#right').hide();
130 - $('#wrong').show().animateCSS('flipInX'); 134 + $('#wrong').show(); //.animateCSS('zoomIn');
131 $('#topic_progress').css('width', (100*params["progress"])+'%').attr('aria-valuenow', 100*params["progress"]); 135 $('#topic_progress').css('width', (100*params["progress"])+'%').attr('aria-valuenow', 100*params["progress"]);
132 showTriesLeft(params["tries"]); 136 showTriesLeft(params["tries"]);
133 - $("fieldset").attr("disabled", "disabled"); 137 + $("fieldset").prop("disabled", true);
  138 + $('#question_div').animateCSS('shake');
134 $("#submit").html("Continuar").off().click(getQuestion); 139 $("#submit").html("Continuar").off().click(getQuestion);
135 break; 140 break;
136 141
package-lock.json
@@ -40,9 +40,9 @@ @@ -40,9 +40,9 @@
40 } 40 }
41 }, 41 },
42 "mdbootstrap": { 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 "mj-context-menu": { 47 "mj-context-menu": {
48 "version": "0.2.0", 48 "version": "0.2.0",
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 "@fortawesome/fontawesome-free": "^5.11.2", 5 "@fortawesome/fontawesome-free": "^5.11.2",
6 "codemirror": "^5.49.2", 6 "codemirror": "^5.49.2",
7 "mathjax": "^3", 7 "mathjax": "^3",
8 - "mdbootstrap": "^4.9.0" 8 + "mdbootstrap": "^4.10.0"
9 }, 9 },
10 "private": true 10 "private": true
11 } 11 }