Exemple #1
0
def estadoValoracion(request, login, course, alumnoid):    
    evaluationSystem = QueryEvaluationSystem().getEvaluationSystemByCourse(course)
    if not evaluationSystem:
        return HttpResponseNotFound()
    
    if not evaluationSystem.isActive():
        return HttpResponseNotFound()
    
    student = QueryStudent().getStudentByUserUJI(alumnoid)
    if not student : return HttpResponseNotFound()

    project = QueryProject().getProjectByCourseAndStudent(course, student)
    if not (project): return HttpResponseNotFound()
    coordinator = False
    if login == alumnoid :
        rol = "A"
    else:
        if login in QueryProject().getloginByRol(project, "TU") and "professorat" in request.path:
            rol = "TU"
            user = QueryUser().getUserByUserUJI(login)
            if not user : return HttpResponseForbidden()
        else:
            coordinator = QueryUser().getUserCoordinatorByUserUJI(login)
            if not coordinator : return HttpResponseForbidden()     
            user = coordinator
            rol = "C"
            
    
    hitos = QueryEvaluationSystemTreeCompleteOfProject(project, True, rol).getList()
    
    grupos = True
    activar=project.isUnresolved()
    cursoActual = QueryCourse().getLastCourse() == course
    return render_to_response("sistemaEvaluacionValoradoListado.html", locals())
Exemple #2
0
def listadoProyectosCoordinador(request, user, course):
    titulo = "Gestió de Projectes"
    muestraTutor = True
    pendientes = QueryProject().getListProjectByCourseAndStatus(course, "P")
    enCurso = gruposProyectosEnCursoTodos(course)
    finalizados = QueryProject().getListProjectByCourseAndStatus(course, "F")
    anyadir = isEditable(course)
    editar = isEditable(course)
    grupos = enCurso
    vacio = not pendientes and not enCurso and not finalizados
    cursos = QueryCourse().getListCourse(request)
    fechaTope = course.fechaTope.strftime(
        '%d/%m/%Y') if course.fechaTope else None
    return render_to_response('proyectoListado.html', locals())
Exemple #3
0
def creaFormulario(request, user, alumnoid, hitoid):
    # COMPROBAR ACCESO
    ''' Coordinador o tutor y proyecto en estado "P" y anteriores hitos completados '''
    course = QueryCourse().getCourseSelected(request)
    student = alumnoPorId(alumnoid)
    project = QueryProject().getProjectByCourseAndStudent(course, student)

    item = QueryItem().getItemByItem(hitoid)
    if not project: return HttpResponseNotFound()
    if project.estado != "P": return HttpResponseForbidden()
    if not item: return HttpResponseNotFound()
    ''' Anteriores hitos completados '''
    itemBefore = QueryItem().getBeforeItem(item)

    if itemBefore:
        response = QueryForm().isAllFormsCompletedOfProjectItem(
            project, itemBefore)
        if not response:
            return HttpResponseForbidden()

    if (request.method == "POST"):
        activaFormulario(project, item)
        return HttpResponseRedirect('/coordinacio/projectes/')

    return render_to_response('creaFormulario.html', locals())
Exemple #4
0
def avisoMail(form):
    item = form.hito
    project = form.proyecto
    rol = form.rol
    subject = u"Reactivació de " + item.nombre.lower(
    ) + " del projecte de l'alumne " + unicode(project.alumno.nombreCompleto())
    to = []
    if rol != "TR":
        for email in QueryProject().getEmailByProjectAndEvaluator(
                project, rol):
            to.append(email)
    else:
        miembro = QueryJudgeMembers().getJudgeMemberByProjectAndMemberId(
            project, form.idMiembro)
        to.append(miembro.getMail())

    email = EvaluaMailMessage(to, subject)

    roles = Evaluacion().getRoles()

    roles["TR"] = "membre del tribunal"

    body = ""
    body += u"S'ha reactivat la valoració de " + item.nombre.lower() + ".\n\n"
    body += u"Com a " + roles[rol].lower(
    ) + u" del alumne " + project.alumno.nombreCompleto(
    ) + u" es necesita la teua valoració.\n"
    body += "\n"
    body += u"Per favor, contesta el siguient formulari per a completar la valoració.\n"
    body += "http://" + SERVER_NAME + "/formulari/" + form.codigo + ' \n'

    email.defineMessage(body)
    email.send()
Exemple #5
0
def activarValoracion(request, user, course, alumnoid):
    student = QueryStudent().getStudentByUserUJI(alumnoid)
    if not student : return HttpResponseNotFound()
    
    project = QueryProject().getProjectByCourseAndStudent(course, student)
    if not project : return HttpResponseNotFound()
                                                 
    if not project.isUnresolved(): return HttpResponseForbidden()
    
    if (request.method == "POST"):
        activaValoracion(project)
        return HttpResponseRedirect('/coordinacio/projectes/')
    
    title = "Activar valoració"
    
    mensaje = u"Clica per a posar en curs l'evaluació de l'alumne " + student.nombreCompleto() + "."

    return render_to_response('mensajeValoracion.html', locals())
Exemple #6
0
def activarValoracion(request, user, course, alumnoid):
    student = QueryStudent().getStudentByUserUJI(alumnoid)
    if not student: return HttpResponseNotFound()

    project = QueryProject().getProjectByCourseAndStudent(course, student)
    if not project: return HttpResponseNotFound()

    if not project.isUnresolved(): return HttpResponseForbidden()

    if (request.method == "POST"):
        activaValoracion(project)
        return HttpResponseRedirect('/coordinacio/projectes/')

    title = "Activar valoració"

    mensaje = u"Clica per a posar en curs l'evaluació de l'alumne " + student.nombreCompleto(
    ) + "."

    return render_to_response('mensajeValoracion.html', locals())
Exemple #7
0
def gruposProyectosEnCursoTodos(course):
    groups = []
    evaluationSystem = QueryEvaluationSystem().getEvaluationSystemByCourse(
        course)
    lockProjects = QueryProject().getListProjectByCourseAndStatus(course, "L")
    if lockProjects: groups.append(LockGroupElement(lockProjects))

    for item in QueryItem().getListItemsByEvaluationSystem(evaluationSystem):
        lista = QueryStatusProjectInCourse().getListProjectByItem(item)
        if lista: groups.append(InCourseGroupElement(lista, item))
    return groups
Exemple #8
0
def gruposProyectosEnCursoProfesor(course, user):
    groups = []
    evaluationSystem = QueryEvaluationSystem().getEvaluationSystemByCourse(
        course)
    lockProjects = QueryProject().getListProjectByCourseStatusTutor(
        course, "L", user)
    if lockProjects: groups.append(LockGroupElement(lockProjects))

    for item in QueryItem().getListItemsByEvaluationSystem(evaluationSystem):
        lista = QueryStatusProjectInCourse().getListProjectByItemAndUser(
            item, user)
        if lista: groups.append(InCourseGroupElement(lista, item))

    return groups
Exemple #9
0
def listadoProyectosProfesor(request, user, course):
    tutor = user
    titulo = "Projectes Assignats"
    enCurso = gruposProyectosEnCursoProfesor(course, user)
    finalizados = QueryProject().getListProjectByCourseStatusTutor(
        course, "F", user)
    anyadir = isEditable(course)
    editar = isEditable(course)
    grupos = enCurso
    vacio = not enCurso and not finalizados
    cursos = QueryCourse().getListCourse(request)
    fechaTope = course.fechaTope.strftime(
        '%d/%m/%Y') if course.fechaTope else None
    return render_to_response('proyectoListado.html', locals())
Exemple #10
0
def estadoValoracion(request, login, course, alumnoid):
    evaluationSystem = QueryEvaluationSystem().getEvaluationSystemByCourse(
        course)
    if not evaluationSystem:
        return HttpResponseNotFound()

    if not evaluationSystem.isActive():
        return HttpResponseNotFound()

    student = QueryStudent().getStudentByUserUJI(alumnoid)
    if not student: return HttpResponseNotFound()

    project = QueryProject().getProjectByCourseAndStudent(course, student)
    if not (project): return HttpResponseNotFound()
    coordinator = False
    if login == alumnoid:
        rol = "A"
    else:
        if login in QueryProject().getloginByRol(
                project, "TU") and "professorat" in request.path:
            rol = "TU"
            user = QueryUser().getUserByUserUJI(login)
            if not user: return HttpResponseForbidden()
        else:
            coordinator = QueryUser().getUserCoordinatorByUserUJI(login)
            if not coordinator: return HttpResponseForbidden()
            user = coordinator
            rol = "C"

    hitos = QueryEvaluationSystemTreeCompleteOfProject(project, True,
                                                       rol).getList()

    grupos = True
    activar = project.isUnresolved()
    cursoActual = QueryCourse().getLastCourse() == course
    return render_to_response("sistemaEvaluacionValoradoListado.html",
                              locals())
Exemple #11
0
def listadoProyectosCoordinadorProfesor(request, user, course, profesorid):
    user = QueryUser().getUserByUserUJI(profesorid)
    if not user:
        return HttpResponseNotFound()

    titulo = "Projectes que tutoritza " + user.nombre
    enCurso = gruposProyectosEnCursoProfesor(course, user)
    finalizados = QueryProject().getListProjectByCourseStatusTutor(
        course, "F", user)
    anyadir = isEditable(course)
    editar = isEditable(course)
    grupos = enCurso
    vacio = not enCurso and not finalizados
    cursos = QueryCourse().getListCourse(request)
    fechaTope = course.fechaTope.strftime(
        '%d/%m/%Y') if course.fechaTope else None
    return render_to_response('proyectoListado.html', locals())
Exemple #12
0
def copiaProyectosEnCursoCursoActualAProyectosPendientesCursoNuevo(course):
    beforeCourse = QueryCourse().getCourseBefore(course)
    projects = QueryProject().getListProjectInCourseByCourse(beforeCourse)
    for project in projects:
        newProject = Proyecto()
        newProject.alumno = project.alumno
        newProject.tutor = project.tutor
        newProject.supervisor = project.supervisor
        newProject.email = project.email
        newProject.curso = course
        newProject.empresa = project.empresa
        newProject.telefono = project.telefono
        newProject.titulo = project.titulo
        newProject.inicio = project.inicio
        newProject.dedicacionSemanal = project.dedicacionSemanal
        newProject.otrosDatos = project.otrosDatos
        newProject.estado = "P"
        newProject.save()
Exemple #13
0
def accesoFormularioPublico(request, clave):
    formForm = QueryForm().getFormByKey(clave)
    if not formForm: return HttpResponseNotFound()
    access = True
    user = None
    if formForm.needUJIAuthentication():
        access = False
        login, redirect = loginFromEujierlogin(request)
        if not login:
            return redirect
        if QueryProject().isUserRolinProject(formForm.proyecto, formForm.rol,
                                             login):
            access = True
            user = QueryUser().getUserByUserUJI(login)
        else:
            coordinador = QueryUser().getUserCoordinatorByUserUJI(login)
            user = coordinador
            if coordinador: access = True

    if access:
        return formularioPublico(request, formForm, user)
    else:
        return HttpResponseForbidden()
Exemple #14
0
def reActivarValoracion(request, user, alumnoid, course, evaluacionid):
    student = QueryStudent().getStudentByUserUJI(alumnoid)
    if not student: return HttpResponseNotFound()
    project = QueryProject().getProjectByCourseAndStudent(course, student)
    if not project: return HttpResponseNotFound()
    evaluation = QueryEvaluation().getEvaluationByEvaluation(evaluacionid)
    if not evaluation: return HttpResponseNotFound()

    if not QueryForm().isFormCompletedOfProjectItemEvaluator(
            project, evaluation.getItem(), evaluation.getEvaluator()):
        return HttpResponseForbidden()

    if (request.method == 'POST'):
        reActivaFormulario(project, evaluation)
        return HttpResponseRedirect(
            request.path.split('formulari/evaluacio/')[0])

    title = "Reactivar formulari"
    mensaje = u"Reactivar el formulari de l'evaluació " + unicode(
        evaluation) + " de " + unicode(evaluation.getItem(
        )) + " de l'alumne " + student.nombreCompleto() + "."

    return render_to_response('mensajeValoracion.html', locals())
Exemple #15
0
def cambiaEstadoTodosLosProyectos(curso):
    listProjects = QueryProject().getListProjectByCourseAndStatus(curso, "L")
    for project in listProjects:
        cambiaEstadoProyecto(project)
Exemple #16
0
def gestionProyectos(request,
                     user,
                     course,
                     accion="nuevo",
                     alumnoid="",
                     profesorid=""):
    project = None
    errors = None
    camposErrores = None
    tutor = None

    if not isEditable(course):
        return HttpResponseForbidden()

    profesor = QueryUser().getUserByUserUJI(profesorid) if profesorid else None

    if profesorid and not profesor:
        return HttpResponseNotFound()

    coordinator = False
    if alumnoid:
        student = QueryStudent().getStudentByUserUJI(alumnoid)
        if student:
            project = QueryProject().getProjectByCourseAndStudent(
                course, student)
            revision = QueryProjectUnresolvedInCourse(
            ).getProjectUnresolvedByProject(project)
            if revision:
                errors = mensajeError(revision)
                camposErrores = revision.campos.split(",")
            if user == project.tutor:
                tutor = user if "professorat" in request.path else None
            else:
                if profesor:
                    if profesor != project.tutor:
                        return HttpResponseNotFound()
                if not user.isCoordinator():
                    return HttpResponseNotFound()
        else:
            if accion != "nuevo":
                return HttpResponseNotFound()
    else:
        tutor = user if "professorat" in request.path else None

    if (request.method == "POST"):
        form = ProyectoAlumnoForm(request, accion, alumnoid, tutor)
        if (form.is_valid()):
            form.save()
            if tutor:
                ruta = '/professorat/projectes/'
            else:
                if profesorid:
                    ruta = '/coordinacio/projectes/' + profesorid + '/'
                else:
                    ruta = '/coordinacio/projectes/'
            return HttpResponseRedirect(ruta)
    else:
        form = ProyectoAlumnoForm(request, accion, alumnoid, tutor)

    ocultaCurso = True

    return render_to_response('proyectoGestion.html', locals())