Commit 094837eb454f6de44a4b11a555ae1c1a1cea0fef

Authored by Miguel Barão
1 parent 8bc0b519
Exists in master and in 1 other branch dev

- progress bar under the menu shows the remaining time.

- update BUGS.md
- add example of random choice of questions in demo.yaml
- update .gitignore
- remove package-lock.json from git repository
@@ -5,7 +5,6 @@ @@ -5,7 +5,6 @@
5 - servidor ntpd para configurar a data/hora dos portateis dell 5 - servidor ntpd para configurar a data/hora dos portateis dell
6 - link na pagina com a nota para voltar ao principio. 6 - link na pagina com a nota para voltar ao principio.
7 - CRITICAL se answer for `i<n` a revisão de provas mostra apenas i (interpreta `<` como tag?) 7 - CRITICAL se answer for `i<n` a revisão de provas mostra apenas i (interpreta `<` como tag?)
8 -- sock.bind(sockaddr) OSError: [Errno 48] Address already in use  
9 - na pagina grade.html as barras estao normalizadas para os limites scale_min e max do teste actual e nao do realizado. 8 - na pagina grade.html as barras estao normalizadas para os limites scale_min e max do teste actual e nao do realizado.
10 - codigo `hello world` nao esta a preservar o whitespace. O renderer de markdown gera a tag <code> que não preserva whitespace. Necessario adicionar <pre>. 9 - codigo `hello world` nao esta a preservar o whitespace. O renderer de markdown gera a tag <code> que não preserva whitespace. Necessario adicionar <pre>.
11 - teste nao esta a mostrar imagens de vez em quando. 10 - teste nao esta a mostrar imagens de vez em quando.
@@ -16,15 +15,14 @@ @@ -16,15 +15,14 @@
16 - melhorar o botao de autorizar (desliga-se), usar antes um botao? 15 - melhorar o botao de autorizar (desliga-se), usar antes um botao?
17 e.g. retornar None quando nao ha alteracoes relativamente à última vez. 16 e.g. retornar None quando nao ha alteracoes relativamente à última vez.
18 ou usar push (websockets?) 17 ou usar push (websockets?)
19 -- lidar com eventos unfocus.  
20 -- servidor nao esta a lidar com eventos scroll/resize. ignorar?  
21 - Test.reset_answers() unused. 18 - Test.reset_answers() unused.
22 - mudar ref do test para test_id (ref já é usado nas perguntas) 19 - mudar ref do test para test_id (ref já é usado nas perguntas)
23 - incluir test_id na tabela questions (futuro semestre, pode quebrar compatibilidade). 20 - incluir test_id na tabela questions (futuro semestre, pode quebrar compatibilidade).
24 -- na pagina admin, mostrar com cor vermelha as horas de entrada dos alunos que ja tenha excedido o tempo 21 +- na pagina admin, mostrar com cor vermelha as horas de entrada dos alunos que ja tenham excedido o tempo
25 22
26 # TODO 23 # TODO
27 24
  25 +- mostrar unfocus e window area em /admin
28 - testar as perguntas todas no início do teste. 26 - testar as perguntas todas no início do teste.
29 - test: mostrar duração do teste com progressbar no navbar. 27 - test: mostrar duração do teste com progressbar no navbar.
30 - submissao fazer um post ajax? 28 - submissao fazer um post ajax?
@@ -65,6 +63,9 @@ ou usar push (websockets?) @@ -65,6 +63,9 @@ ou usar push (websockets?)
65 63
66 # FIXED 64 # FIXED
67 65
  66 +- lidar com eventos unfocus.
  67 +- servidor nao esta a lidar com eventos resize.
  68 +- sock.bind(sockaddr) OSError: [Errno 48] Address already in use
68 - dizer quanto desconta em cada pergunta de escolha multipla 69 - dizer quanto desconta em cada pergunta de escolha multipla
69 - se houver erros a abrir ficheiros .yaml de perguntas, depois dos testes diz "No errors found". 70 - se houver erros a abrir ficheiros .yaml de perguntas, depois dos testes diz "No errors found".
70 - se faltarem files na especificação do teste, o check não detecta e factory não gera para essas perguntas. 71 - se faltarem files na especificação do teste, o check não detecta e factory não gera para essas perguntas.
demo/demo.yaml
@@ -64,9 +64,10 @@ questions: @@ -64,9 +64,10 @@ questions:
64 - tut-information 64 - tut-information
65 - tut-success 65 - tut-success
66 - tut-warning 66 - tut-warning
67 - - tut-alert 67 + - [tut-alert1, tut-alert2]
68 - tut-generator 68 - tut-generator
69 69
  70 +
70 # test: 71 # test:
71 # - ref1 72 # - ref1
72 # - block: a 73 # - block: a
demo/questions/questions-tutorial.yaml
@@ -535,8 +535,24 @@ @@ -535,8 +535,24 @@
535 535
536 # ---------------------------------------------------------------------------- 536 # ----------------------------------------------------------------------------
537 - type: alert 537 - type: alert
538 - ref: tut-alert  
539 - title: Texto informativo (perigo) 538 + ref: tut-alert1
  539 + title: Texto informativo (perigo) - versão 1
  540 + text: |
  541 + Não conta para avaliação. Texto importante.
  542 +
  543 + ![planetas](planets.png "Planetas do Sistema Solar")
  544 +
  545 + As imagens podem ser adicionadas usando a notação standard em markdown. Há
  546 + duas possibilidads:
  547 +
  548 + - Imagens inline: não têm título definido e podem ser incluídas no meio de
  549 + uma linha de texto usando`![alt text](image.jpg)`.
  550 + - Imagens centradas com título: `![alt text](image.jpg "Título da imagem")`.
  551 + O título aprece por baixo da imagem. O título pode ser uma string vazia.
  552 +
  553 +- type: alert
  554 + ref: tut-alert2
  555 + title: Texto informativo (perigo) - versão 2
540 text: | 556 text: |
541 Não conta para avaliação. Texto importante. 557 Não conta para avaliação. Texto importante.
542 558
@@ -555,7 +571,7 @@ @@ -555,7 +571,7 @@
555 text: | 571 text: |
556 This question is not included in the test and will not shown up. 572 This question is not included in the test and will not shown up.
557 It also lacks a "ref" and is automatically named 573 It also lacks a "ref" and is automatically named
558 - `questions/questions-tutorial.yaml:0012`. 574 + `questions/questions-tutorial.yaml:0013`.
559 A warning is shown on the console about this. 575 A warning is shown on the console about this.
560 The number at the end is the index position of this question. 576 The number at the end is the index position of this question.
561 Indices start at 0. 577 Indices start at 0.
perguntations/__init__.py
@@ -32,7 +32,7 @@ proof of submission and for review. @@ -32,7 +32,7 @@ proof of submission and for review.
32 ''' 32 '''
33 33
34 APP_NAME = 'perguntations' 34 APP_NAME = 'perguntations'
35 -APP_VERSION = '2020.04.dev4' 35 +APP_VERSION = '2020.04.dev5'
36 APP_DESCRIPTION = __doc__ 36 APP_DESCRIPTION = __doc__
37 37
38 __author__ = 'Miguel Barão' 38 __author__ = 'Miguel Barão'
perguntations/templates/test.html
@@ -44,8 +44,12 @@ @@ -44,8 +44,12 @@
44 <!-- ===================================================================== --> 44 <!-- ===================================================================== -->
45 <body> 45 <body>
46 <!-- ===================================================================== --> 46 <!-- ===================================================================== -->
  47 +<div class="progress fixed-top" style="height: 60px; border-radius: 0px;">
  48 + <div class="progress-bar bg-secondary" role="progressbar" style="width: 100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>
  49 +</div>
47 50
48 <nav id="navbar" class="navbar navbar-expand-sm fixed-top navbar-dark bg-dark"> 51 <nav id="navbar" class="navbar navbar-expand-sm fixed-top navbar-dark bg-dark">
  52 +
49 <a class="navbar-brand" href="#"> 53 <a class="navbar-brand" href="#">
50 <img src="/static/logo_horizontal.png" height="30" alt=""> 54 <img src="/static/logo_horizontal.png" height="30" alt="">
51 </a> 55 </a>
@@ -62,6 +66,7 @@ @@ -62,6 +66,7 @@
62 <li class="nav-item"><h5> 66 <li class="nav-item"><h5>
63 <span class="navbar-text" id="clock"> --:-- </span> 67 <span class="navbar-text" id="clock"> --:-- </span>
64 </h5> 68 </h5>
  69 +
65 </li> 70 </li>
66 </ul> 71 </ul>
67 72
@@ -76,6 +81,7 @@ @@ -76,6 +81,7 @@
76 </li> 81 </li>
77 </ul> 82 </ul>
78 </div> 83 </div>
  84 +
79 </nav> 85 </nav>
80 86
81 <!-- ===================================================================== --> 87 <!-- ===================================================================== -->
@@ -152,7 +158,8 @@ @@ -152,7 +158,8 @@
152 </script> 158 </script>
153 159
154 <script> 160 <script>
155 - var finishtime = new Date().getTime() + {{ t['duration']*60*1000 }}; 161 + var duration = {{ t['duration']*60*1000 }}; // ms
  162 + var finishtime = new Date().getTime() + duration;
156 163
157 {% if t['duration'] == 0 %} 164 {% if t['duration'] == 0 %}
158 $("#clock").html("+\u221e"); 165 $("#clock").html("+\u221e");
@@ -161,7 +168,7 @@ @@ -161,7 +168,7 @@
161 // Update the count down every 1 second 168 // Update the count down every 1 second
162 var x = setInterval(function() { 169 var x = setInterval(function() {
163 var now = new Date().getTime(); 170 var now = new Date().getTime();
164 - var distance = finishtime - now; 171 + var distance = finishtime - now; // ms
165 172
166 // Time calculations for days, hours, minutes and seconds 173 // Time calculations for days, hours, minutes and seconds
167 var minutes = Math.floor((distance / (1000 * 60))); 174 var minutes = Math.floor((distance / (1000 * 60)));
@@ -180,6 +187,9 @@ @@ -180,6 +187,9 @@
180 $("#test").submit(); 187 $("#test").submit();
181 {% end %} 188 {% end %}
182 } 189 }
  190 +
  191 + var progress = distance/duration*100 + '%'
  192 + $('.progress-bar').css('width', progress).attr('aria-valuenow', progress);
183 }, 1000); 193 }, 1000);
184 194
185 {% end %} 195 {% end %}