示例#1
0
文件: forms.py 项目: landreup/UJI
    def __init__(self, request, studentUserUJI):
        self.request = request
        course = QueryCourse().getCourseSelected(self.request)
        items = QueryItem().getListItemsByEvaluationSystem(
            QueryEvaluationSystem().getEvaluationSystemByCourse(course))

        self.project = None
        if studentUserUJI:
            self.project = QueryProject().getProjectByCourseAndStudent(
                QueryCourse().getCourseSelected(request),
                QueryStudent().getStudentByUserUJI(studentUserUJI))

        projectStatus = QueryStatusProjectInCourse().getProjectByProject(
            self.project)
        if projectStatus:
            nextItem = QueryItem().getNextItem(projectStatus.hito)
        else:
            nextItem = QueryItem().getFirstItemCourse(course)
        self.forms = []
        self.fechas = []
        inputDate = False
        duration = 0
        for item in items:
            if self.project:
                if self.project.estado == "C":
                    if item == projectStatus.hito: inputDate = True
                elif self.project.estado == "L":
                    if item == nextItem: inputDate = True
            else:
                inputDate = True
            if inputDate:
                if request.method == "POST":
                    fecha = request.POST.get(str(item.id) + "-fecha", '')
                    form = {
                        "id": str(item.id) + "-fecha",
                        "label": item.nombre,
                        "plazo": duration + item.plazo,
                        "form": EstimateDateForm(request.POST,
                                                 prefix=str(item.id))
                    }
                    if fecha:
                        self.fechas.append({"item": item, "fecha": fecha})
                else:
                    form = {
                        "id": str(item.id) + "-fecha",
                        "label": item.nombre,
                        "plazo": duration + item.plazo,
                        "form": EstimateDateForm(prefix=str(item.id))
                    }
                    estimateDate = QueryEstimateDate(
                    ).getEstimateDateByProjectAndItem(self.project, item)
                    if estimateDate:
                        form["form"].initial["fecha"] = estimateDate.fecha
                self.forms.append(form)
            else:
                duration += item.plazo
示例#2
0
文件: forms.py 项目: landreup/UJI
    def __init__(self, request, studentUserUJI):
        self.numberOfJudgeMembers = NUMBER_OF_JUDGE_MEMBERS

        self.request = request

        self.project, self.judgeMembers = None, None

        if studentUserUJI:
            self.project = QueryProject().getProjectByCourseAndStudent(
                QueryCourse().getCourseSelected(self.request),
                QueryStudent().getStudentByUserUJI(studentUserUJI))
            self.judgeMembers = QueryJudgeMembers().getListMembersByProject(
                self.project)

        self.forms = []
        self.id_members = []
        for i in xrange(self.numberOfJudgeMembers):
            if request.method == 'POST':
                id_member = request.POST.get("miembro" + str(i) + "-miembro",
                                             '')
                form = MemberJudgeForm(request.POST, prefix="miembro" + str(i))
                if id_member:
                    self.id_members.append({
                        'id': i + 1,
                        'id_member': id_member
                    })
            else:
                form = MemberJudgeForm(prefix="miembro" + str(i))
                form.fields["miembro"].queryset = QueryUser().getListOfUser()
                if self.judgeMembers:
                    form.initial["miembro"] = self.judgeMembers[i].miembro
            self.forms.append(form)
示例#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())
示例#4
0
文件: views.py 项目: landreup/UJI
def editaCurso(request, user, curso):
    cursoA = int(curso.split("/")[0])
    cursoB = int(curso.split("/")[1])
    if cursoA+1 != cursoB :  return HttpResponseNotFound()
    curso = cursoA
    
    cursoForm = Curso()
    cursoDB = QueryCourse().getCourseByCourse(curso)
    
    if not cursoDB : return HttpResponseNotFound()
    
    if (request.method == "POST") :
        form = CursoForm(request.POST, instance=cursoForm)
        if form.is_valid():
            cursoDB.fechaTope = cursoForm.fechaTope
            cursoDB.save()
            return HttpResponseRedirect('/coordinacio/cursos/')
    else:
        form = CursoForm(initial={'fechaTope':cursoDB.fechaTope})
    
    return render_to_response('edicionCurso.html', locals())
示例#5
0
def editaCurso(request, user, curso):
    cursoA = int(curso.split("/")[0])
    cursoB = int(curso.split("/")[1])
    if cursoA + 1 != cursoB: return HttpResponseNotFound()
    curso = cursoA

    cursoForm = Curso()
    cursoDB = QueryCourse().getCourseByCourse(curso)

    if not cursoDB: return HttpResponseNotFound()

    if (request.method == "POST"):
        form = CursoForm(request.POST, instance=cursoForm)
        if form.is_valid():
            cursoDB.fechaTope = cursoForm.fechaTope
            cursoDB.save()
            return HttpResponseRedirect('/coordinacio/cursos/')
    else:
        form = CursoForm(initial={'fechaTope': cursoDB.fechaTope})

    return render_to_response('edicionCurso.html', locals())
示例#6
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())
示例#7
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())
示例#8
0
def iniciaAplicacion(request, login):
    if QueryCourse().getLastCourse():
        return HttpResponseForbidden()

    if (request.method == "POST"):
        form = ProfesorForm(request)
        if (form.is_valid()):
            form.save()
            curso = Curso(curso=int(datetime.date.today().year))
            curso.save()
            newEvaluationSystem = SistemaEvaluacion(curso=curso, estado="D")
            newEvaluationSystem.save()
            return HttpResponseRedirect('/coordinacio/projectes/')
    else:
        form = ProfesorForm(request)
    return render_to_response('inicializaAplicacion.html', locals())
示例#9
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())
示例#10
0
文件: forms.py 项目: landreup/UJI
 def save(self, project):
     if not self.project:
         self.project = QueryProject().getProjectByCourseAndStudent(
             QueryCourse().getCourseSelected(self.request), self.student)
     self.judgeMembers = QueryJudgeMembers().getListMembersByProject(
         project)
     for member in self.id_members:
         user = QueryUser().getUserById(member['id_member'])
         memberDB = MiembroTribunal()
         if self.judgeMembers:
             for judgeMember in self.judgeMembers:
                 if judgeMember.idMiembro == member['id']:
                     memberDB = judgeMember
         memberDB.proyecto = project
         memberDB.idMiembro = member['id']
         memberDB.miembro = user
         memberDB.save()
示例#11
0
文件: views.py 项目: landreup/UJI
def listadoHitos(request, user, course):
    if request.method == 'POST':
        if not editable(request):
            return HttpResponseForbidden
        copiarSistemaEvaluacionCursoAnteriorAlCursoActual(request)
        return HttpResponseRedirect('/coordinacio/evaluacio/')

    sistemaEvaluacion = QueryEvaluationSystem().getEvaluationSystemByCourse(
        course)

    hitos = listaHitos(sistemaEvaluacion) if (sistemaEvaluacion) else None

    cursos = QueryCourse().getListCourse(request)
    grupos = hitos == None
    edita = editable(request)
    anyadir = editable(request)
    activar = activable(request)
    return render_to_response('sistemaEvaluacionListado.html', locals())
示例#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()
示例#13
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())
示例#14
0
文件: queries.py 项目: landreup/UJI
 def getEvaluationSystemByCourseSelected(self, request):
     return self.getEvaluationSystemByCourse(QueryCourse().getCourseSelected(request))
示例#15
0
文件: forms.py 项目: landreup/UJI
    def __init__(self, request, action="nuevo", alumnoUserUJI="", tutor=None):
        self.alumno = Alumno()
        self.proyecto = Proyecto()
        self.tutor = None
        self.action = action
        self.request = request
        self.alumnoid = alumnoUserUJI
        self.estado = None
        self.course = QueryCourse().getCourseSelected(self.request)

        self.tutorForm = None
        self.tribunalForm = None
        self.dateForm = None

        coordinator = tutor == None

        if action != "nuevo":
            self.alumno = QueryStudent().getStudentByUserUJI(alumnoUserUJI)
            self.proyecto = QueryProject().getProjectByCourseAndStudent(
                QueryCourse().getCourseSelected(self.request), self.alumno)

            self.estado = self.proyecto.estado
            if coordinator:
                statusProject = QueryStatusProjectInCourse(
                ).getProjectByProject(self.proyecto)
                item = statusProject.hito if statusProject else None
                if self.proyecto.estado == "L":
                    nextItem = QueryItem().getNextItem(
                        item) if item else QueryItem().getFirstItemCourse(
                            self.proyecto.curso)
                else:
                    nextItem = item
                if QueryItem().hasTribunalEvaluationThisItem(nextItem):
                    self.tribunalForm = TribunalForm(request, alumnoUserUJI)

        self.alumnoForm = AlumnoForm(prefix='alumno', instance=self.alumno)
        self.proyectoForm = ProyectoForm(prefix='proyecto',
                                         instance=self.proyecto)
        self.dateForm = EstimateDateItemForm(
            request, alumnoUserUJI) if self.estado != "P" else None

        if coordinator:
            if action != "nuevo":
                self.tutor = self.proyecto.tutor
            self.tutorForm = TutorForm(prefix='tutor')
            self.tutorForm.fields["tutor"].queryset = QueryUser(
            ).getListOfTutorCoordinator()
            self.tutorForm.initial["tutor"] = self.tutor
        else:
            self.tutor = tutor

        if request.method == 'POST':  # Leer los datos
            if action != "nuevo":
                if coordinator:
                    statusProject = QueryStatusProjectInCourse(
                    ).getProjectByProject(self.proyecto)
                    item = statusProject.hito if statusProject else None
                    if self.estado == "L":
                        nextItem = QueryItem().getNextItem(
                            item) if item else QueryItem().getFirstItemCourse(
                                self.proyecto.curso)
                    else:
                        nextItem = item

                    if QueryItem().hasTribunalEvaluationThisItem(nextItem):
                        self.tribunalForm = TribunalForm(
                            request, alumnoUserUJI)

            self.alumnoForm = AlumnoForm(request.POST,
                                         prefix='alumno',
                                         instance=self.alumno)
            self.proyectoForm = ProyectoForm(request.POST,
                                             prefix='proyecto',
                                             instance=self.proyecto)
            self.dateForm = EstimateDateItemForm(
                request, alumnoUserUJI) if self.estado != "P" else None
            if coordinator:
                self.tutorId = self.proyectoForm.data["tutor-tutor"]
            else:
                self.tutorId = self.tutor.id
示例#16
0
def listadoCursos(request, user):
    campo = "Cursos"
    listado = QueryCourse().getListCourse(request)
    anyadir = True
    return render_to_response('cursoListado.html', locals())
示例#17
0
def isEditable(course):
    return QueryCourse().isActual(course) and QueryEvaluationSystem(
    ).isEvaluationSystemEnabledByCourse(course)
示例#18
0
 def wrapped(*args, **kwargs):
     request = args[0]
     course = QueryCourse().getCourseSelected(request)
     if not course:
         return HttpResponseServerError()
     return f(course=course, *args, **kwargs)
示例#19
0
def copiarSistemaEvaluacionCursoAnteriorAlCursoActual(request):
    cursoActual = QueryCourse().getCourseSelected(request)
    cursoAnterior = QueryCourse().getCourseBefore(cursoActual)
    
    copyEvaluationSystem(cursoAnterior, cursoActual)