X-Git-Url: https://git.llucax.com/z.facultad/75.52/sercom.git/blobdiff_plain/52359436d60992517ff1b7a7f1a89652e28c0c62..547d05bc0d164faa1e0f6d4b3e8c744ba47a534b:/sercom/controllers.py diff --git a/sercom/controllers.py b/sercom/controllers.py index f809731..944d50b 100644 --- a/sercom/controllers.py +++ b/sercom/controllers.py @@ -6,7 +6,7 @@ from turbogears import identity, redirect from cherrypy import request, response from turbogears.toolbox.catwalk import CatWalk import model -from model import InstanciaDeEntrega, Correccion, AND, DateTimeCol, Entrega, Grupo, AlumnoInscripto +from model import Visita, VisitaUsuario, InstanciaDeEntrega, Correccion, AND, DateTimeCol, Entrega, Grupo, AlumnoInscripto from sqlobject import * # from sercom import json @@ -48,6 +48,7 @@ class Root(controllers.RootController): instancias_activas=instancias, now=now) if 'entregar' in identity.current.permissions: + last_login = Visita.select(AND(VisitaUsuario.q.user_id == identity.current.user.id, Visita.q.visit_key == VisitaUsuario.q.visit_key))[-1:][0].created # Proximas instancias de entrega instancias = list(InstanciaDeEntrega.select( AND(InstanciaDeEntrega.q.inicio <= now, @@ -61,7 +62,10 @@ class Root(controllers.RootController): except: pass entregas = list(Entrega.select(IN(Entrega.q.entregadorID, m))[:5]) - return dict(instancias_activas=instancias, now=now, entregas=entregas) + + # Ultimas correcciones + correcciones = list(Correccion.select(AND(IN(Correccion.q.entregadorID, m), Correccion.q.corregido >= last_login))) + return dict(instancias_activas=instancias, now=now, entregas=entregas, correcciones=correcciones) return dict() @expose(template='.templates.login') @@ -121,8 +125,6 @@ class Root(controllers.RootController): curso = CursoController() - docente_inscripto = DocenteInscriptoController() - correccion = CorreccionController() admin = identity.SecureObject(CatWalk(model), identity.has_permission('admin')) @@ -151,7 +153,7 @@ def summarize(text, size, concat=True, continuation='...'): >>> summarize(text, 68, False, ' [...]') 'Why is it that nobody remembers the name of Johann\nGambolputty [...]' >>> summarize(text, 68, continuation=' >>') - 'Why is it that nobody remembers the name of Johann Gambolputty de >>' + 'Why is it that nobody remembers the name of Johann\nGambolputty de >>' """ if text is not None: if concat: