diff --git a/BUGS.md b/BUGS.md index c013cc2..2909df8 100644 --- a/BUGS.md +++ b/BUGS.md @@ -1,26 +1,25 @@ # BUGS +- botao de autorizar desliga-se, fazer debounce. +e.g. retornar None quando nao ha alteracoes relativamente à última vez. +ou usar push (websockets?) - quando scale_max não é 20, as cores das barras continuam a reflectir a escala 0,20 - CRITICAL se answer for `i que não preserva whitespace. Necessario adicionar
.
 - teste nao esta a mostrar imagens de vez em quando.
-- ordenacao das notas em /admin nao é numerica, é ascii...
 - mensagems de erro do assembler aparecem na mesma linha na correcao e nao fazerm rendering do `$t`, ver se servidor faz parse do markdown dessas mensagens.
 - impedir os eventos copy/paste. alunos usam isso para trazer codigo ja feito nos computadores. Obrigar a fazer reset? fazer um copy automaticamente?
 - a revisao do teste não mostra as imagens.
-- melhorar o botao de autorizar (desliga-se), usar antes um botao?
-e.g. retornar None quando nao ha alteracoes relativamente à última vez.
-ou usar push (websockets?)
 - Test.reset_answers() unused.
-- mudar ref do test para test_id (ref já é usado nas perguntas)
 - incluir test_id na tabela questions (futuro semestre, pode quebrar compatibilidade).
 - na pagina admin, mostrar com cor vermelha as horas de entrada dos alunos que ja tenham excedido o tempo
 
 # TODO
 
-- servidor ntpd para configurar a data/hora dos portateis dell
+- mudar ref do test para test_id (ref já é usado nas perguntas)
+- servidor ntpd no x220 para configurar a data/hora dos portateis dell
 - autorização dada, mas teste não disponível até que seja dada ordem para começar.
 - alunos com necessidades especiais nao podem ter autosubmit. ter um autosubmit_exceptions: ['123', '456']
 - mostrar unfocus e window area em /admin
diff --git a/perguntations/__init__.py b/perguntations/__init__.py
index bb76f04..a928eb1 100644
--- a/perguntations/__init__.py
+++ b/perguntations/__init__.py
@@ -32,7 +32,7 @@ proof of submission and for review.
 '''
 
 APP_NAME = 'perguntations'
-APP_VERSION = '2020.05.dev1'
+APP_VERSION = '2020.05.dev2'
 APP_DESCRIPTION = __doc__
 
 __author__ = 'Miguel Barão'
diff --git a/perguntations/app.py b/perguntations/app.py
index c4dc8c3..c4c229e 100644
--- a/perguntations/app.py
+++ b/perguntations/app.py
@@ -294,7 +294,7 @@ class App():
         writer = csv.writer(csvstr, delimiter=';', quoting=csv.QUOTE_ALL)
         writer.writerow(('Número', 'Nota', 'Início', 'Fim'))
         writer.writerows(grades)
-        return csvstr.getvalue()
+        return self.testfactory['ref'], csvstr.getvalue()
 
     def get_student_test(self, uid, default=None):
         '''get test from online student'''
diff --git a/perguntations/serve.py b/perguntations/serve.py
index 79c0b16..2f2e703 100644
--- a/perguntations/serve.py
+++ b/perguntations/serve.py
@@ -184,10 +184,11 @@ class AdminWebservice(BaseHandler):
         '''admin webservices that do not change state'''
         cmd = self.get_query_argument('cmd')
         if cmd == 'testcsv':
+            test_ref, data = self.testapp.get_test_csv()
             self.set_header('Content-Type', 'text/csv')
             self.set_header('content-Disposition',
-                            'attachment; filename=notas.csv')
-            self.write(self.testapp.get_test_csv())
+                            f'attachment; filename={test_ref}.csv')
+            self.write(data)
             await self.flush()
 
 # ----------------------------------------------------------------------------
diff --git a/perguntations/test.py b/perguntations/test.py
index e2d7ed1..3f53e31 100644
--- a/perguntations/test.py
+++ b/perguntations/test.py
@@ -9,6 +9,7 @@ from os import path
 import random
 from datetime import datetime
 import logging
+import re
 
 # this project
 from perguntations.questions import QFactory, QuestionException
@@ -123,10 +124,13 @@ class TestFactory(dict):
 
 
     # ------------------------------------------------------------------------
-    def check_missing_ref(self):
+    def check_test_ref(self):
         '''Test must have a `ref`'''
         if 'ref' not in self:
             raise TestFactoryException('Missing "ref" in configuration!')
+        if not re.match(r'^[a-zA-Z0-9_-]+$', self['ref']):
+            raise TestFactoryException('Test "ref" can only contain the '
+                                       'characters a-zA-Z0-9_-')
 
     def check_missing_database(self):
         '''Test must have a database'''
@@ -208,7 +212,7 @@ class TestFactory(dict):
         Checks for valid keys and sets default values.
         Also checks if some files and directories exist
         '''
-        self.check_missing_ref()
+        self.check_test_ref()
         self.check_missing_database()
         self.check_missing_answers_directory()
         self.check_answers_directory_writable()
--
libgit2 0.21.2