Commit 74a38303ebbdfc7abe428e3e70df4f5e4946dfa0

Authored by Miguel Barão
1 parent 9db32bd0
Exists in master and in 1 other branch dev

- show type of submission

- fix timer when there is no time limit
demo/demo.yaml
... ... @@ -22,7 +22,7 @@ title: Teste de demonstração (tutorial)
22 22 # Duration in minutes.
23 23 # (0 or undefined means infinite time)
24 24 duration: 10
25   -autosubmit: false
  25 +autosubmit: true
26 26  
27 27 # Show points for each question, scale 0-20.
28 28 # (default: false)
... ...
perguntations/__init__.py
... ... @@ -32,7 +32,7 @@ proof of submission and for review.
32 32 '''
33 33  
34 34 APP_NAME = 'perguntations'
35   -APP_VERSION = '2020.03.dev1'
  35 +APP_VERSION = '2020.04.dev1'
36 36 APP_DESCRIPTION = __doc__
37 37  
38 38 __author__ = 'Miguel Barão'
... ...
perguntations/templates/test.html
... ... @@ -91,7 +91,11 @@
91 91 </div>
92 92 <div class="row">
93 93 <label for="duracao" class="col-sm-3">Duração:</label>
94   - <div class="col-sm-9" id="duracao">{{ str(t['duration'])+' minutos' if t['duration'] > 0 else chr(8734) }}</div>
  94 + <div class="col-sm-9" id="duracao">{{ str(t['duration'])+' minutos' if t['duration'] > 0 else 'sem limite' }}</div>
  95 + </div>
  96 + <div class="row">
  97 + <label for="submissao" class="col-sm-3">Submissão:</label>
  98 + <div class="col-sm-9" id="submissao">{{ 'automática' if t['autosubmit'] else 'manual' }}</div>
95 99 </div>
96 100 </h5>
97 101 </div>
... ... @@ -147,9 +151,14 @@
147 151 </script>
148 152  
149 153 <script>
150   -
151 154 var finishtime = new Date().getTime() + {{ t['duration']*60*1000 }};
152 155  
  156 + {% if t['duration'] == 0 %}
  157 + $("#clock").html("+\u221e");
  158 + {% else %}
  159 +
  160 +
  161 +
153 162 // Update the count down every 1 second
154 163 var x = setInterval(function() {
155 164 var now = new Date().getTime();
... ... @@ -159,8 +168,8 @@
159 168 var minutes = Math.floor((distance / (1000 * 60)));
160 169 var seconds = Math.floor((distance % (1000 * 60)) / 1000);
161 170  
162   - if (distance >= 1000*50) {
163   - $("#clock").html(minutes + ":" + seconds);
  171 + if (distance >= 1000*60) {
  172 + $("#clock").html(minutes + ":" + (seconds<10?'0':'') +seconds);
164 173 }
165 174 else if (distance >= 0) {
166 175 $("#navbar").removeClass('bg-dark').addClass("bg-danger");
... ... @@ -174,6 +183,8 @@
174 183 }
175 184 }, 1000);
176 185  
  186 + {% end %}
  187 +
177 188 </script>
178 189  
179 190  
... ...