From ef03716c7924a1fd0189dff27cd5bac90d50dde5 Mon Sep 17 00:00:00 2001 From: Miguel Barao Date: Mon, 22 Jun 2015 16:15:33 +0100 Subject: [PATCH] - minor corrections in MANUAL.md - fixed order of the students in /result, added elapsed time and cosmetic changes - new icon (pomba) --- BUGS.md | 14 +++++++++----- MANUAL.md | 21 ++++++++++++--------- database.py | 4 ++-- serve.py | 2 +- static/favicon.ico | Bin 33914 -> 0 bytes templates/grade.html | 2 +- templates/results.html | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++------------- 7 files changed, 75 insertions(+), 31 deletions(-) diff --git a/BUGS.md b/BUGS.md index 45a62a3..1a38e45 100644 --- a/BUGS.md +++ b/BUGS.md @@ -1,19 +1,22 @@ - + # BUGS !!! - questions type script, necessário dar um caminho exacto relativamete ao directorio do server em vez da pergunta. deveria ser possivel mover as perguntas de directorio sem rebentar os caminhos. -- colisoes nas referencias das perguntas. a referencia deveria influir o nome do ficheiro? +- parece que é preciso criar à mão a pasta para as respostas (ans/...) depois apercebo-me que os caminhos no teste dizem respeito à directoria donde o teste é corrido... as respostas deveriam guardadas no directório dado. +- colisoes nas referencias das perguntas. a referencia deveria influir o nome do ficheiro? acho que nao - se database for mal configurada, é criada uma base de dados vazia e rebenta na autenticacao. - mostrar erro quando nao consegue importar questions files - testar regex na definicao das perguntas. como se faz rawstring em yaml? singlequote? problemas de backslash??? sim... necessário fazer \\ em varios casos, mas não é claro! e.g. \n é convertido em espaço mas \w é convertido em \\ e w. - +- testar envio de parametros para stdin para perguntas tipo generator. +- usar pomba da ue moderna. # TODO +- pacotes exactos usados para instalar. +- SQLAlchemy em vez da classe database. - Criar botão para o docente fazer enable/disable do aluno explicitamente (exames presenciais). -- testar envio de parametros para stdin para perguntas tipo generator. - hash das passwords obtidas da concatenacao do numero de aluno com password (evita que passwords repetidas sejam detectadas). - permitir enviar varios testes, aluno escolhe qual o teste que quer fazer. - criar script json2md.py ou outra forma de gerar um teste ja realizado @@ -23,10 +26,11 @@ - criar perguntas de outros tipos, e.g. associação, ordenação, varios textinput - perguntas para professor corrigir mais tarde. - testar com microsoft surface. - +- share do score em /results (email) # FIXED +- /results esta ordenado por numero e nao por data - numeros das perguntas não fazem sentido quando há caixas de informação (numerar informacao tb?) - Quando apresenta o teste, preencher com os valores definidos em answer (permite que professor dê informação à partida, e no modo practice fiquem com o preenchido anteriormente) - information points é definido onde? test.y ou questions.py? diff --git a/MANUAL.md b/MANUAL.md index 98ab6d1..cc3ad0b 100644 --- a/MANUAL.md +++ b/MANUAL.md @@ -113,18 +113,20 @@ A test is a file in `yaml` format that can reside anywhere on the filesystem. It # Each question has a default value of 1.0 point, but it can be overridden. # The points defined here do not need to be normalized (it's automatic). questions: - - ref: - - first-question-1 # randomly choose one from these 3 questions - - first-question-2 - - first-question-3 - points: 0.5 + - ref: + - first-question-1 # randomly choose one from these 3 questions + - first-question-2 + - first-question-3 + points: 0.5 - - ref: second-question # just one question, 1.0 point (unnormalized) + - ref: second-question # one question, 1.0 point (unnormalized) - - third-question # "ref:" not needed in simple cases + - third-question # "ref:" not needed in simple cases - - wrong-question # ref: missing because we also have - points: 2 # points: +This following one is wrong: + + - wrong-question # missing "ref:" key + points: 2 Some of the options have default values if they are omitted. The defaults are the following: @@ -134,6 +136,7 @@ Some of the options have default values if they are omitted. The defaults are th show_hints: False show_points: False practice_mode: False + show_ref: False debug: False points: 1.0 diff --git a/database.py b/database.py index a0ec6bc..b9efeb1 100644 --- a/database.py +++ b/database.py @@ -20,12 +20,12 @@ class Database(object): # only the best result for each student cmd = ''' - SELECT student_id, name, MAX(grade) + SELECT student_id, name, MAX(grade), finish_time FROM students INNER JOIN tests ON students.number=tests.student_id WHERE test_id==? AND student_id!=0 GROUP BY student_id - ORDER BY grade DESC;''' + ORDER BY grade DESC, finish_time DESC;''' return c.execute(cmd, [test_id]).fetchall() # get list of students in the database diff --git a/serve.py b/serve.py index 5e1b686..4bba835 100755 --- a/serve.py +++ b/serve.py @@ -23,7 +23,7 @@ class Root(object): self.database = database.Database(testconf['database']) self.auth = AuthController(database=testconf['database']) self.templates = TemplateLookup(directories=['templates'], input_encoding='utf-8') - self.tags = {'online': set(), 'finished': set()} # should be in application, not server + self.tags = {'online': set(), 'finished': set()} # FIXME should be in application, not server # --- DEFAULT ------------------------------------------------------------ # any path, e.g. /xpto/aargh is redirected to the test diff --git a/static/favicon.ico b/static/favicon.ico index 5d4a108..b234a75 100644 Binary files a/static/favicon.ico and b/static/favicon.ico differ diff --git a/templates/grade.html b/templates/grade.html index a230c50..d91463d 100644 --- a/templates/grade.html +++ b/templates/grade.html @@ -109,7 +109,7 @@ - Média + Média (não ponderada)
<% diff --git a/templates/results.html b/templates/results.html index 4b587b5..e2ade2a 100644 --- a/templates/results.html +++ b/templates/results.html @@ -25,6 +25,10 @@ box-shadow: 0px 2px 10px 3px rgba(0, 0, 0, .2); border-radius:5px; } + .progress { + margin-bottom: 0px; + border-radius: 25px; + } @@ -62,25 +66,41 @@ ${t['title']}
- +
- - - - - - + + + + + + - % for r in results: + <%! + from datetime import datetime + %> + % for r in results: - - + + + % endfor -- libgit2 0.21.2
PosiçãoNúmeroNomeNota (0-20)
#NomeNota
${loop.index+1}${r[0]} + % if loop.index == 0: +

+ + 1º + +

+ % else: + + ${loop.index+1} + + % endif +
% if loop.index == 0: - - %endif - ${r[1]} +

${r[1]}

+ % else: + ${r[1]} + % endif
@@ -95,6 +115,23 @@
+ <% + dt = datetime.now() - datetime.strptime(r[3], '%Y-%m-%d %H:%M:%S.%f') + %> + + % if dt.days > 0: + ${dt.days}d + % elif dt.seconds >= 3600: + (${dt.seconds // 3600} horas + % elif dt.seconds >= 60: + (${dt.seconds // 60} minutos + % else: + (${dt.seconds} segundos + % endif + + +