Exemplo n.º 1
0
def section(request, evaluation_set_id, section_id):
    section = Section.objects.get(pk=section_id)
    evaluation_set = EvaluationSet.objects.get(pk=evaluation_set_id)

    if request.GET.get("unmask_comments") == "1" and request.user.has_perm(
            "courseevaluations.can_unmask_comments"):
        unmask_comments = True
    else:
        unmask_comments = False

    evaluables = CourseEvaluation.objects.filter(section=section,
                                                 evaluation_set=evaluation_set)

    response = HttpResponse(content_type='application/pdf')

    title = "{course:}: {section:} with {teacher:} ({evaluation_set:})".format(
        course=section.course.course_name,
        section=section.csn,
        teacher=section.teacher.name,
        evaluation_set=evaluation_set.name)

    build_report(response,
                 evaluables,
                 title=title,
                 unmask_comments=unmask_comments)

    return response
Exemplo n.º 2
0
def teacher_course(request, evaluation_set_id, teacher_id, course_id):
    course = Course.objects.get(pk=course_id)
    teacher = Teacher.objects.get(pk=teacher_id)
    evaluation_set = EvaluationSet.objects.get(pk=evaluation_set_id)
    
    if request.GET.get("unmask_comments") == "1" and request.user.has_perm("courseevaluations.can_unmask_comments"):
        unmask_comments=True
    else:
        unmask_comments=False
    
    sections = Section.objects.filter(course=course, teacher=teacher)
    
    evaluables = CourseEvaluation.objects.filter(section__in=sections, evaluation_set=evaluation_set)
    
    response = HttpResponse(content_type='application/pdf')
    response['Content-Disposition'] = 'filename="report.pdf"'
    
    title = "{course:} with {teacher:} ({evaluation_set:})".format(
        course=course.course_name,
        teacher=teacher.name,
        evaluation_set=evaluation_set.name
        )
    
    build_report(response, evaluables, title=title, unmask_comments=unmask_comments)
    
    return response
Exemplo n.º 3
0
def teacher_course(request, evaluation_set_id, teacher_id, course_id):
    course = Course.objects.get(pk=course_id)
    teacher = Teacher.objects.get(pk=teacher_id)
    evaluation_set = EvaluationSet.objects.get(pk=evaluation_set_id)

    if request.GET.get("unmask_comments") == "1" and request.user.has_perm(
            "courseevaluations.can_unmask_comments"):
        unmask_comments = True
    else:
        unmask_comments = False

    sections = Section.objects.filter(course=course, teacher=teacher)

    evaluables = CourseEvaluation.objects.filter(section__in=sections,
                                                 evaluation_set=evaluation_set)

    response = HttpResponse(content_type='application/pdf')
    response['Content-Disposition'] = 'filename="report.pdf"'

    title = "{course:} with {teacher:} ({evaluation_set:})".format(
        course=course.course_name,
        teacher=teacher.name,
        evaluation_set=evaluation_set.name)

    build_report(response,
                 evaluables,
                 title=title,
                 unmask_comments=unmask_comments)

    return response
Exemplo n.º 4
0
def dorm_parent_dorm_parent(request, evaluation_set_id, dorm_id, parent_id):
    evaluation_set = EvaluationSet.objects.get(pk=evaluation_set_id)
    dorm = Dorm.objects.get(pk=dorm_id)
    parent = Teacher.objects.get(pk=parent_id)

    if request.GET.get("unmask_comments") == "1" and request.user.has_perm(
            "courseevaluations.can_unmask_comments"):
        unmask_comments = True
    else:
        unmask_comments = False

    evaluables = DormParentEvaluation.objects.filter(
        evaluation_set=evaluation_set, dorm=dorm, parent=parent)

    response = HttpResponse(content_type='application/pdf')

    title = "{dorm:} with {parent:} ({evaluation_set:})".format(
        dorm=str(dorm), parent=parent.name, evaluation_set=evaluation_set.name)

    build_report(response,
                 evaluables,
                 title=title,
                 unmask_comments=unmask_comments)

    return response
Exemplo n.º 5
0
def aggregate(request, evaluation_set_id):
    evaluation_set = EvaluationSet.objects.get(pk=evaluation_set_id)
    
    evaluables = CourseEvaluation.objects.filter(evaluation_set=evaluation_set)
    
    response = HttpResponse(content_type='application/pdf')
    response['Content-Disposition'] = 'filename="report.pdf"'
    
    title = "All evaluations for {evaluation_set:}".format(evaluation_set=evaluation_set.name)
    build_report(response, evaluables, title=title, comments=False)
    return response
Exemplo n.º 6
0
def aggregate(request, evaluation_set_id):
    evaluation_set = EvaluationSet.objects.get(pk=evaluation_set_id)

    evaluables = CourseEvaluation.objects.filter(evaluation_set=evaluation_set)

    response = HttpResponse(content_type='application/pdf')
    response['Content-Disposition'] = 'filename="report.pdf"'

    title = "All evaluations for {evaluation_set:}".format(
        evaluation_set=evaluation_set.name)
    build_report(response, evaluables, title=title, comments=False)
    return response
Exemplo n.º 7
0
def grade(request, evaluation_set_id, grade_id):
    evaluation_set = EvaluationSet.objects.get(pk=evaluation_set_id)
    grade = Grade.objects.get(pk=grade_id)
    
    evaluables = CourseEvaluation.objects.filter(
        evaluation_set=evaluation_set, enrollment__grade=grade)
        
    response = HttpResponse(content_type='application/pdf')
    response['Content-Disposition'] = 'filename="{grade:} ({evaluation_set:}).pdf"'.format(grade=grade, evaluation_set=evaluation_set.name)
    
    title = "All evaluations for {grade:} ({evaluation_set:})".format(grade=grade, evaluation_set=evaluation_set.name)
    build_report(response, evaluables, title=title, comments=False)
    return response
Exemplo n.º 8
0
def dorm_parent_parent(request, evaluation_set_id, parent_id):
    evaluation_set = EvaluationSet.objects.get(pk=evaluation_set_id)
    parent = Teacher.objects.get(pk=parent_id)

    evaluables = DormParentEvaluation.objects.filter(
        evaluation_set=evaluation_set, parent=parent)

    response = HttpResponse(content_type='application/pdf')

    title = "Dorm Parent Evaluation for {parent:} ({evaluation_set:})".format(
        parent=parent.name, evaluation_set=evaluation_set.name)

    build_report(response, evaluables, title=title)

    return response
Exemplo n.º 9
0
def dorm_parent_parent(request, evaluation_set_id, parent_id):
    evaluation_set = EvaluationSet.objects.get(pk=evaluation_set_id)
    parent = Teacher.objects.get(pk=parent_id)
    
    evaluables = DormParentEvaluation.objects.filter(evaluation_set=evaluation_set, parent=parent)
    
    response = HttpResponse(content_type='application/pdf')
    
    title = "Dorm Parent Evaluation for {parent:} ({evaluation_set:})".format(
        parent=parent.name,
        evaluation_set=evaluation_set.name
        )
    
    build_report(response, evaluables, title=title)
    
    return response
Exemplo n.º 10
0
def grade(request, evaluation_set_id, grade_id):
    evaluation_set = EvaluationSet.objects.get(pk=evaluation_set_id)
    grade = Grade.objects.get(pk=grade_id)

    evaluables = CourseEvaluation.objects.filter(evaluation_set=evaluation_set,
                                                 enrollment__grade=grade)

    response = HttpResponse(content_type='application/pdf')
    response[
        'Content-Disposition'] = 'filename="{grade:} ({evaluation_set:}).pdf"'.format(
            grade=grade, evaluation_set=evaluation_set.name)

    title = "All evaluations for {grade:} ({evaluation_set:})".format(
        grade=grade, evaluation_set=evaluation_set.name)
    build_report(response, evaluables, title=title, comments=False)
    return response
Exemplo n.º 11
0
def zip_teacher_course(request, evaluation_set_id):
    evaluation_set = EvaluationSet.objects.get(pk=evaluation_set_id)
    
    evaluables = CourseEvaluation.objects.filter(evaluation_set=evaluation_set)
    
    by_teacher = {}
    
    for course_evaluation in evaluables:
        teacher = course_evaluation.section.teacher
        course = course_evaluation.section.course
        
        if not teacher in by_teacher:
            by_teacher[teacher] = {}
        
        if not course in by_teacher[teacher]:
            by_teacher[teacher][course] = []
        
        by_teacher[teacher][course].append(course_evaluation)
    
    out = BytesIO()
    with ZipFile(out, mode='w', compression=ZIP_STORED) as zip_file:
        for teacher in by_teacher:
            for course in by_teacher[teacher]:
                evaluables = by_teacher[teacher][course]
                title = "{course:} with {teacher:} ({evaluation_set:})".format(
                    course=course.course_name,
                    teacher=teacher.name,
                    evaluation_set=evaluation_set.name
                    )
                
                
                report_file = BytesIO()
                build_report(report_file, evaluables, title)
                file_name = "{department:}/{last_name:}, {first_name:}/{course:}.pdf".format(
                    department = course.department,
                    last_name = teacher.last_name,
                    first_name=teacher.first_name,
                    course=course.course_name,
                )
                
                zip_file.writestr(file_name, report_file.getvalue())
    
    response = HttpResponse(content_type='application/zip')
    response['Content-Disposition'] = 'filename="Course Evaluations by Department, Teacher, and Course for {evaluation_set:}.zip"'.format(evaluation_set=evaluation_set.name)
    
    response.write(out.getvalue())
    return response
Exemplo n.º 12
0
def zip_teacher_course(request, evaluation_set_id):
    evaluation_set = EvaluationSet.objects.get(pk=evaluation_set_id)

    evaluables = CourseEvaluation.objects.filter(evaluation_set=evaluation_set)

    by_teacher = {}

    for course_evaluation in evaluables:
        teacher = course_evaluation.section.teacher
        course = course_evaluation.section.course

        if not teacher in by_teacher:
            by_teacher[teacher] = {}

        if not course in by_teacher[teacher]:
            by_teacher[teacher][course] = []

        by_teacher[teacher][course].append(course_evaluation)

    out = BytesIO()
    with ZipFile(out, mode='w', compression=ZIP_STORED) as zip_file:
        for teacher in by_teacher:
            for course in by_teacher[teacher]:
                evaluables = by_teacher[teacher][course]
                title = "{course:} with {teacher:} ({evaluation_set:})".format(
                    course=course.course_name,
                    teacher=teacher.name,
                    evaluation_set=evaluation_set.name)

                report_file = BytesIO()
                build_report(report_file, evaluables, title)
                file_name = "{department:}/{last_name:}, {first_name:}/{course:}.pdf".format(
                    department=course.department,
                    last_name=teacher.last_name,
                    first_name=teacher.first_name,
                    course=course.course_name,
                )

                zip_file.writestr(file_name, report_file.getvalue())

    response = HttpResponse(content_type='application/zip')
    response[
        'Content-Disposition'] = 'filename="Course Evaluations by Department, Teacher, and Course for {evaluation_set:}.zip"'.format(
            evaluation_set=evaluation_set.name)

    response.write(out.getvalue())
    return response
Exemplo n.º 13
0
def zip_dorm_parent_dorm_dorm_parent(request, evaluation_set_id):
    evaluation_set = EvaluationSet.objects.get(pk=evaluation_set_id)

    evaluables = DormParentEvaluation.objects.filter(
        evaluation_set=evaluation_set)

    by_dorm = {}

    for dorm_parent_evaluation in evaluables:
        dorm = dorm_parent_evaluation.dorm
        parent = dorm_parent_evaluation.parent

        if not dorm in by_dorm:
            by_dorm[dorm] = {}

        if not parent in by_dorm[dorm]:
            by_dorm[dorm][parent] = []

        by_dorm[dorm][parent].append(dorm_parent_evaluation)

    out = BytesIO()
    with ZipFile(out, mode='w', compression=ZIP_STORED) as zip_file:
        for dorm in by_dorm:
            for parent in by_dorm[dorm]:
                evaluables = by_dorm[dorm][parent]
                title = "{dorm:} with {parent:} ({evaluation_set:})".format(
                    dorm=str(dorm),
                    parent=parent.name,
                    evaluation_set=evaluation_set.name)

                report_file = BytesIO()
                build_report(report_file, evaluables, title)
                file_name = "{dorm:}/{last_name:}, {first_name:}.pdf".format(
                    dorm=str(dorm),
                    last_name=parent.last_name,
                    first_name=parent.first_name,
                )

                zip_file.writestr(file_name, report_file.getvalue())

    response = HttpResponse(content_type='application/zip')
    response[
        'Content-Disposition'] = 'filename="Dorm Evaluations by Dorm and Parent for {evaluation_set:}.zip"'.format(
            evaluation_set=evaluation_set.name)

    response.write(out.getvalue())
    return response
Exemplo n.º 14
0
def zip_dorm_parent_dorm_dorm_parent(request, evaluation_set_id):
    evaluation_set = EvaluationSet.objects.get(pk=evaluation_set_id)
    
    evaluables = DormParentEvaluation.objects.filter(evaluation_set=evaluation_set)
    
    by_dorm = {}
    
    for dorm_parent_evaluation in evaluables:
        dorm = dorm_parent_evaluation.dorm
        parent = dorm_parent_evaluation.parent
        
        if not dorm in by_dorm:
            by_dorm[dorm] = {}
        
        if not parent in by_dorm[dorm]:
            by_dorm[dorm][parent] = []
        
        by_dorm[dorm][parent].append(dorm_parent_evaluation)
    
    out = BytesIO()
    with ZipFile(out, mode='w', compression=ZIP_STORED) as zip_file:
        for dorm in by_dorm:
            for parent in by_dorm[dorm]:
                evaluables = by_dorm[dorm][parent]
                title = "{dorm:} with {parent:} ({evaluation_set:})".format(
                    dorm = str(dorm),
                    parent=parent.name,
                    evaluation_set=evaluation_set.name
                    )
                
                report_file = BytesIO()
                build_report(report_file, evaluables, title)
                file_name = "{dorm:}/{last_name:}, {first_name:}.pdf".format(
                    dorm = str(dorm),
                    last_name = parent.last_name,
                    first_name=parent.first_name,
                )
                
                zip_file.writestr(file_name, report_file.getvalue())
    
    response = HttpResponse(content_type='application/zip')
    response['Content-Disposition'] = 'filename="Dorm Evaluations by Dorm and Parent for {evaluation_set:}.zip"'.format(evaluation_set=evaluation_set.name)
    
    response.write(out.getvalue())
    return response
Exemplo n.º 15
0
def melp_aggregate(request, evaluation_set_id):
    evaluation_set = EvaluationSet.objects.get(pk=evaluation_set_id)

    if request.GET.get("unmask_comments") == "1" and request.user.has_perm("courseevaluations.can_unmask_comments"):
        unmask_comments=True
    else:
        unmask_comments=False
    
    evaluables = MELPEvaluation.objects.filter(evaluation_set=evaluation_set)

    response = HttpResponse(content_type='application/pdf')

    title = "Aggregate MELP Results ({evaluation_set:})".format(
        evaluation_set=evaluation_set.name
        )

    build_report(response, evaluables, title=title, unmask_comments=unmask_comments)

    return response
Exemplo n.º 16
0
def melp_section(request, evaluation_set_id, section_id):
    section = Section.objects.get(pk=section_id)
    evaluation_set = EvaluationSet.objects.get(pk=evaluation_set_id)

    if request.GET.get("unmask_comments") == "1" and request.user.has_perm("courseevaluations.can_unmask_comments"):
        unmask_comments=True
    else:
        unmask_comments=False
    
    evaluables = MELPEvaluation.objects.filter(section=section, evaluation_set=evaluation_set)

    response = HttpResponse(content_type='application/pdf')

    title = "{melp_name:} ({evaluation_set:})".format(
        melp_name=section.course_name,
        evaluation_set=evaluation_set.name
        )

    build_report(response, evaluables, title=title, unmask_comments=unmask_comments)

    return response
Exemplo n.º 17
0
def dorm_parent_dorm(request, evaluation_set_id, dorm_id):
    evaluation_set = EvaluationSet.objects.get(pk=evaluation_set_id)
    dorm = Dorm.objects.get(pk=dorm_id)
    
    if request.GET.get("unmask_comments") == "1" and request.user.has_perm("courseevaluations.can_unmask_comments"):
        unmask_comments=True
    else:
        unmask_comments=False
    
    evaluables = DormParentEvaluation.objects.filter(evaluation_set=evaluation_set, dorm=dorm)
    
    response = HttpResponse(content_type='application/pdf')
    
    title = "Dorm Parent Evaluation for {dorm:} ({evaluation_set:})".format(
        dorm = str(dorm),
        evaluation_set=evaluation_set.name
        )
    
    build_report(response, evaluables, title=title, unmask_comments=unmask_comments)
    
    return response
Exemplo n.º 18
0
def iip(request, evaluation_set_id, teacher_id):
    evaluation_set = EvaluationSet.objects.get(pk=evaluation_set_id)
    teacher = Teacher.objects.get(pk=teacher_id)
    
    if request.GET.get("unmask_comments") == "1" and request.user.has_perm("courseevaluations.can_unmask_comments"):
        unmask_comments=True
    else:
        unmask_comments=False
    
    evaluables = IIPEvaluation.objects.filter(evaluation_set=evaluation_set, teacher=teacher)
    
    response = HttpResponse(content_type='application/pdf')
    
    title = "IIP with {teacher:} ({evaluation_set:})".format(
        teacher=teacher.name,
        evaluation_set=evaluation_set.name
        )
    
    build_report(response, evaluables, title=title, unmask_comments=unmask_comments)
    
    return response
Exemplo n.º 19
0
def zip_iip(request, evaluation_set_id):
    evaluation_set = EvaluationSet.objects.get(pk=evaluation_set_id)
    
    evaluables = IIPEvaluation.objects.filter(evaluation_set=evaluation_set)
    
    by_teacher = {}
    
    for iip_evaluation in evaluables:
        teacher = iip_evaluation.teacher
        
        if not teacher in by_teacher:
            by_teacher[teacher] = []
        
        by_teacher[teacher].append(iip_evaluation)
    
    out = BytesIO()
    with ZipFile(out, mode='w', compression=ZIP_STORED) as zip_file:
        for teacher in by_teacher:
            evaluables = by_teacher[teacher]
            title = "IIP with {teacher:} ({evaluation_set:})".format(
                teacher=teacher.name,
                evaluation_set=evaluation_set.name
                )
            
            
            report_file = BytesIO()
            build_report(report_file, evaluables, title)
            file_name = "{last_name:}, {first_name:}.pdf".format(
                last_name = teacher.last_name,
                first_name=teacher.first_name,
            )
            
            zip_file.writestr(file_name, report_file.getvalue())
    
    response = HttpResponse(content_type='application/zip')
    response['Content-Disposition'] = 'filename="IIP Evaluations by Teacher for {evaluation_set:}.zip"'.format(evaluation_set=evaluation_set.name)
    
    response.write(out.getvalue())
    return response
Exemplo n.º 20
0
def melp_section_zip(request, evaluation_set_id):
    evaluation_set = EvaluationSet.objects.get(pk=evaluation_set_id)
    
    evaluables = MELPEvaluation.objects.filter(evaluation_set=evaluation_set)
    
    by_melp = {}
    
    for melp_evaluation in evaluables:
        section = melp_evaluation.section
        
        if not section in by_melp:
            by_melp[section] = []
        
        by_melp[section].append(melp_evaluation)
    
    out = BytesIO()
    with ZipFile(out, mode='w', compression=ZIP_STORED) as zip_file:
        for melp in by_melp:
            evaluables = by_melp[melp]
            title = "{melp:} ({evaluation_set:})".format(
                melp = melp.course_name,
                evaluation_set=evaluation_set.name
                )
            
            
            report_file = BytesIO()
            build_report(report_file, evaluables, title)
            file_name = "{melp:}.pdf".format(
                melp = melp.course_name,
            )
            
            zip_file.writestr(file_name, report_file.getvalue())
    
    response = HttpResponse(content_type='application/zip')
    response['Content-Disposition'] = 'filename="MELP Evaluations for {evaluation_set:}.zip"'.format(evaluation_set=evaluation_set.name)
    
    response.write(out.getvalue())
    return response
Exemplo n.º 21
0
def zip_iip(request, evaluation_set_id):
    evaluation_set = EvaluationSet.objects.get(pk=evaluation_set_id)

    evaluables = IIPEvaluation.objects.filter(evaluation_set=evaluation_set)

    by_teacher = {}

    for iip_evaluation in evaluables:
        teacher = iip_evaluation.teacher

        if not teacher in by_teacher:
            by_teacher[teacher] = []

        by_teacher[teacher].append(iip_evaluation)

    out = BytesIO()
    with ZipFile(out, mode='w', compression=ZIP_STORED) as zip_file:
        for teacher in by_teacher:
            evaluables = by_teacher[teacher]
            title = "IIP with {teacher:} ({evaluation_set:})".format(
                teacher=teacher.name, evaluation_set=evaluation_set.name)

            report_file = BytesIO()
            build_report(report_file, evaluables, title)
            file_name = "{last_name:}, {first_name:}.pdf".format(
                last_name=teacher.last_name,
                first_name=teacher.first_name,
            )

            zip_file.writestr(file_name, report_file.getvalue())

    response = HttpResponse(content_type='application/zip')
    response[
        'Content-Disposition'] = 'filename="IIP Evaluations by Teacher for {evaluation_set:}.zip"'.format(
            evaluation_set=evaluation_set.name)

    response.write(out.getvalue())
    return response
Exemplo n.º 22
0
def iip(request, evaluation_set_id, teacher_id):
    evaluation_set = EvaluationSet.objects.get(pk=evaluation_set_id)
    teacher = Teacher.objects.get(pk=teacher_id)

    if request.GET.get("unmask_comments") == "1" and request.user.has_perm(
            "courseevaluations.can_unmask_comments"):
        unmask_comments = True
    else:
        unmask_comments = False

    evaluables = IIPEvaluation.objects.filter(evaluation_set=evaluation_set,
                                              teacher=teacher)

    response = HttpResponse(content_type='application/pdf')

    title = "IIP with {teacher:} ({evaluation_set:})".format(
        teacher=teacher.name, evaluation_set=evaluation_set.name)

    build_report(response,
                 evaluables,
                 title=title,
                 unmask_comments=unmask_comments)

    return response