From 03ce95b6b4735ac353999a4ee8969762a3a25766 Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Sat, 5 Mar 2005 23:55:42 +0000 Subject: [PATCH] =?utf8?q?Nuevo=20comando=20para=20hacer=20la=20entrega=20?= =?utf8?q?final=20de=20una=20entrega:=20sc=5Fdeliver.=20Por=20ahora=20solo?= =?utf8?q?=20genera=20las=20Correccion()es=20pertinentes,=20pero=20no=20en?= =?utf8?q?v=C3=ADa=20mails=20para=20notificar=20nada=20a=20nadie.=20Se=20a?= =?utf8?q?grega=20columna=20'finalizada'=20a=20entrega=20para=20indicar=20?= =?utf8?q?si=20ya=20fue=20'procesada'.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- doc/schema.dia | Bin 3655 -> 3670 bytes doc/schema.sql | 1 + src/T/DBO/Entrega.php | 2 ++ src/sercom/sqlo.py | 14 +++++++++++--- test/test_data.sql | 31 +++++++++++++++++++++++++------ 5 files changed, 39 insertions(+), 9 deletions(-) diff --git a/doc/schema.dia b/doc/schema.dia index 6e49f70d9b025816626856008e0e8e5b16293f54..33c32973e083caa6bb45c6ca9603f881f2b77f85 100644 GIT binary patch literal 3670 zcmZ{ncQhO99>-%wDWZC*)GT5at-WJY6|^W?HCnC2tW|r@Dpge~wpz877>Sj(_Do4z zlo%Czgcz}U`@Z+wf8KlU^Eu}^pXdAU@0{=NJbXzEfWHsTrrmwdMFntZzP)3>EXRv$ zcMf5)dj3s%Ouo+}oX|fMbuz9PR7-->bKnP#;U{SyeMokS;xHoZJ1wX2Q(YSa0`56W z|91G1YhLo!JJCCN_Q{FxWCO`pfoa5sO47D{7@DC+GbH3NG)g#LT3*qhoz9)6P~zq?`}1)nyVh{T9dXmRtMr9Ssv3bxBEz3e;+Zpvr?ZL0m3o+=du{DRbWj9Jv5(VBm^{eO|At6hf9;tHD z_oxiZW<70GFxOT6JA)`BB95#t#}4;C)o8>mK&A14$WyLO2VoTVqQ!S0ewX6tanj9V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NnFv_+z*hd9) zv6kv>qSKT>ew;W>WaAc=Df)KNuPmV9RW0&<3g#pc*{<*o-u$ZsNN(+_-la18Itzcx z^WIX;`LLruZmZ(begP6;LA~^3V%=Rc9vn^aJ3{kdcIcwMXaI9&e3olGhHdf}NgjuV)~y zVDH*M_mryJ<6GCnP1PYrtXi`@gKs=Q4m#A*{WNZ7cOm^rxLKJKr*p^VSjpmCdb7O~%yvVTAR5&p#LN~&}SvOa( z+4db1d4|Q0nun#iJ>dv$)e@ke{rr7>h%{=x;LKjD?9L`g?PdwJ8i&P`3z|k#%1vpr z3mWft$P7WL2P)61x14G;IG#*F8$V#Wx~pyJp#AI^A5n$9;4Dxwn2S=4H3<&aLrf2+ z!7=kMyAK=4I%Ir5%H?9@>mi0or}L791Gfo&YV~%J(E4B243i>~+@2=7_eKz$zCIzq zUTzW*@Hyxx^3yS-I%2l4?RN+cim^J1V zVb)N3@8{^aE>{jd8zPe$J)XbMkY-pei_=)r)K DB_DATAOBJECT_INT, 'desde' => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME, 'hasta' => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME, + 'finalizada' => DB_DATAOBJECT_INT + DB_DATAOBJECT_BOOL, ); } diff --git a/src/sercom/sqlo.py b/src/sercom/sqlo.py index de62085..9673e00 100644 --- a/src/sercom/sqlo.py +++ b/src/sercom/sqlo.py @@ -3,6 +3,7 @@ from sqlobject.sqlbuilder import * import errno import os from os import path +from datetime import datetime __all__ = ('Curso', 'Inscripto', 'Docente', 'Ejercicio', 'Entrega', 'CasoDePrueba', 'Intento', 'Correccion', 'Prueba') @@ -13,9 +14,9 @@ dir_base = '.' class BaseSQLObject(SQLObject): @classmethod - def by(cls, connection = None, **kw): + def by(cls, **kw): try: - return cls.selectBy(connection = connection, **kw)[0] + return cls.selectBy(limit=1, **kw)[0] except IndexError: raise SQLObjectNotFound, "The object %s with columns %s does not exist" % (cls.__name__, kw) @@ -77,11 +78,18 @@ class Entrega(BaseSQLObject): ejercicio = ForeignKey('Ejercicio') desde = DateTimeCol() hasta = DateTimeCol() + finalizada = BoolCol(default=False) # Joins cursos = MultipleJoin('Curso') correcciones = MultipleJoin('Correccion') intentos = MultipleJoin('Intento') + @classmethod + def getPendientes(cls, connection=None): + return cls.select((cls.q.finalizada == False) + & (cls.q.hasta <= datetime.now()), + orderBy=cls.q.hasta, connection=connection) + class CasoDePrueba(BaseSQLObject): # Clave ejercicio = ForeignKey('Ejercicio') @@ -142,7 +150,7 @@ class Intento(BaseSQLObject): @classmethod def getProximoAProbar(cls, connection=None): try: - return cls.select(None == cls.q.compila, limit=1, + return cls.select(cls.q.compila == None, limit=1, orderBy=cls.q.llegada, connection=connection)[0] except IndexError: return None diff --git a/test/test_data.sql b/test/test_data.sql index 02fdd62..e5dfeba 100644 --- a/test/test_data.sql +++ b/test/test_data.sql @@ -21,20 +21,39 @@ INSERT INTO curso_docente VALUES (5, 2); INSERT INTO curso_docente VALUES (6, 4); -- Inscriptos (id, padron, curso_id, mail, activo) -INSERT INTO inscripto VALUES (1, 77891, 6, 'luca-alumno@llucax.hn.org', 1); -INSERT INTO inscripto VALUES (2, 77892, 6, 'luca-alumno2@llucax.hn.org', 1); +INSERT INTO inscripto VALUES (1, 10000, 5, 'luca-alumno@llucax.hn.org', 1); +INSERT INTO inscripto VALUES (2, 20000, 6, 'luca-alumno2@llucax.hn.org', 1); +INSERT INTO inscripto VALUES (3, 20000, 5, 'luca-alumno3@llucax.hn.org', 1); -- Ejercicios (id, nombre, numero, docente_id) INSERT INTO ejercicio VALUES (1, 'Punteros inteligentes', 4, 1); -INSERT INTO ejercicio VALUES (2, 'XML parser', 4, 2); +INSERT INTO ejercicio VALUES (2, 'Prueba stdin/stdout/stderr', 1, 2); --- Entregas (id, curso_id, nro_ejercicio, entrega, ejercicio_id, desde, hasta) -INSERT INTO entrega VALUES (1, 6, 4, 1, 1, '2005-01-26', '2005-02-26 20:00:00'); -INSERT INTO entrega VALUES (2, 6, 4, 2, 1, '2005-02-06', '2005-02-16 20:00:00'); +-- Entregas (id, curso_id, nro_ejercicio, entrega, ejercicio_id, desde, hasta, finalizada) +INSERT INTO entrega VALUES (1, 5, 1, 1, 1, '2005-03-02', '2005-03-05 20:00:00', 0); +INSERT INTO entrega VALUES (2, 6, 4, 2, 2, '2005-03-08', '2005-03-16 20:00:00', 0); -- Casos de prueba (id, ejercicio_id, nombre, privado, activo, parametros, codigo_retorno, tiempo_cpu) INSERT INTO caso_de_prueba VALUES (1, 1, 'basico', 0, 1, NULL, 0, NULL); INSERT INTO caso_de_prueba VALUES (2, 1, 'complicado', 0, 1, '--full', 0, 600); INSERT INTO caso_de_prueba VALUES (3, 1, 'tramposo', 1, 1, '--full --no-full "parametros \"raros\""', NULL, NULL); +INSERT INTO caso_de_prueba VALUES (4, 2, 'normal', 0, 1, NULL, 0, NULL); + +-- Intentos (id, inscripto_id, entrega_id, numero, llegada, inicio_compila, fin_compila, inicio_pruebas, fin_pruebas, compila, mail_respuesta, observaciones) +INSERT INTO intento VALUES (1, 1, 1, 1, '2005-02-06', '2005-02-06', '2005-02-06', '2005-02-06', '2005-02-06', 0, 'luca-rta@llucax.hn.org', NULL); +INSERT INTO intento VALUES (2, 1, 1, 2, '2005-02-07', '2005-02-07', '2005-02-07', '2005-02-07', '2005-02-07', 1, 'luca-rta@llucax.hn.org', NULL); +INSERT INTO intento VALUES (3, 1, 1, 3, '2005-02-08', '2005-02-08', '2005-02-08', '2005-02-08', '2005-02-08', 1, 'luca-rta@llucax.hn.org', NULL); +INSERT INTO intento VALUES (4, 3, 1, 3, '2005-02-08', '2005-02-08', '2005-02-08', '2005-02-08', '2005-02-08', 1, 'luca-rta2@llucax.hn.org', NULL); + +-- Pruebas (id, intento_id, caso_de_prueba_id, inicio, fin, pasada, observaciones) +INSERT INTO prueba VALUES (1, 2, 1, '2005-02-07', '2005-02-07', 0, NULL); +INSERT INTO prueba VALUES (2, 2, 2, '2005-02-07', '2005-02-07', 1, NULL); +INSERT INTO prueba VALUES (3, 2, 3, '2005-02-07', '2005-02-07', 0, NULL); +INSERT INTO prueba VALUES (4, 3, 1, '2005-02-07', '2005-02-07', 1, NULL); +INSERT INTO prueba VALUES (5, 3, 2, '2005-02-07', '2005-02-07', 1, NULL); +INSERT INTO prueba VALUES (6, 3, 3, '2005-02-07', '2005-02-07', 0, NULL); +INSERT INTO prueba VALUES (7, 4, 1, '2005-02-07', '2005-02-07', 1, NULL); +INSERT INTO prueba VALUES (8, 4, 2, '2005-02-07', '2005-02-07', 1, NULL); +INSERT INTO prueba VALUES (9, 5, 3, '2005-02-07', '2005-02-07', 1, NULL); -- vim: set tw=0 et : -- 2.43.0