Exemplo n.º 1
0
def get_reviews_for_mandate(current_user_role, mandate, style):
    data = generate_headers(
        ['reviewer', 'review', 'remark', 'justification', 'confidential'],
        style)
    if current_user_role is user_role.ADMINISTRATOR:
        reviews = review.find_by_mandate(mandate.id)
    else:
        reviews = find_before_mandate_state(mandate, current_user_role)
    for rev in reviews:
        if rev.status == review_status.IN_PROGRESS:
            break
        if rev.reviewer is None:
            person = "{} {}<br/>({})".format(
                mandate.assistant.supervisor.first_name,
                mandate.assistant.supervisor.last_name, str(_('supervisor')))
        else:
            person = "{} {}<br/>({})".format(
                rev.reviewer.person.first_name, rev.reviewer.person.last_name,
                entity_version.get_last_version(rev.reviewer.entity).acronym)
        data.append([
            Paragraph(person, style),
            Paragraph(_(rev.advice), style),
            Paragraph(rev.remark or '', style),
            Paragraph(rev.justification or '', style),
            Paragraph(rev.confidential or '', style)
        ])
    return data
 def test_get_reviews_for_mandate(self):
     style = self.styles['BodyText']
     data = export_utils_pdf.generate_headers(
         ['reviewer', 'review', 'remark', 'justification', 'confidential'],
         style)
     reviews = find_by_mandate(self.mandate.id)
     for rev in reviews:
         if rev.status == review_status.IN_PROGRESS:
             break
         if rev.reviewer is None:
             person = "{} {}<br/>({})".format(
                 self.mandate.assistant.supervisor.first_name,
                 self.mandate.assistant.supervisor.last_name,
                 str(_('supervisor')))
         else:
             person = "{} {}<br/>({})".format(
                 rev.reviewer.person.first_name,
                 rev.reviewer.person.last_name,
                 get_last_version(rev.reviewer.entity).acronym)
         data.append([
             Paragraph(person, style),
             Paragraph(_(rev.advice), style),
             Paragraph(rev.remark or '', style),
             Paragraph(rev.justification or '', style),
             Paragraph(rev.confidential or '', style)
         ])
     self.assertEqual(
         str(data),
         str(
             export_utils_pdf.get_reviews_for_mandate(
                 user_role.ADMINISTRATOR, self.mandate, style)))
Exemplo n.º 3
0
 def test_get_reviews_for_mandate(self):
     style = self.styles['BodyText']
     data = export_utils_pdf.generate_headers(
         ['reviewer', 'review', 'remark', 'justification', 'confidential'],
         style)
     reviews = find_by_mandate(self.mandate.id)
     for rev in reviews:
         if rev.status == review_status.IN_PROGRESS:
             break
         if rev.reviewer is None:
             supervisor = "<br/>(%s)" % (str(_('supervisor')))
             person = self.mandate.assistant.supervisor.first_name + " " \
                      + self.mandate.assistant.supervisor.last_name + supervisor
         else:
             entity = get_last_version(rev.reviewer.entity).acronym
             person = rev.reviewer.person.first_name + " " + rev.reviewer.person.last_name + "<br/>(" + entity + ")"
         data.append([
             Paragraph(person, style),
             Paragraph(_(rev.advice), style),
             Paragraph(rev.remark or '', style),
             Paragraph(rev.justification or '', style),
             Paragraph(rev.confidential or '', style)
         ])
     self.assertEqual(
         str(data),
         str(export_utils_pdf.get_reviews_for_mandate(self.mandate, style)))
Exemplo n.º 4
0
def reviews_view(request, mandate_id):
    reviews = find_by_mandate(mandate_id)
    mandate = assistant_mandate.find_mandate_by_id(mandate_id)
    return render(
        request, 'manager_reviews_view.html', {
            'mandate_id': mandate_id,
            'year': mandate.academic_year.year + 1,
            'reviews': reviews
        })
def reviews_view(request, mandate_id):
    reviews = find_by_mandate(mandate_id)
    mandate = assistant_mandate.find_mandate_by_id(mandate_id)
    can_go_backward = mandate_can_go_backward(mandate)

    return render(
        request, 'manager_reviews_view.html', {
            'mandate_id': mandate_id,
            'year': mandate.academic_year.year + 1,
            'reviews': reviews,
            'can_go_backward': can_go_backward
        })
def reviews_view(request, mandate_id):
    reviews = find_by_mandate(mandate_id)
    mandate = assistant_mandate.find_mandate_by_id(mandate_id)
    can_go_backward = mandate_can_go_backward(mandate)

    return render(
        request, 'manager_reviews_view.html',
        {
            'mandate_id': mandate_id,
            'year': mandate.academic_year.year + 1,
            'reviews': reviews,
            'can_go_backward': can_go_backward
        }
    )
Exemplo n.º 7
0
def add_mandate_content(content, mandate, styles, current_user_role):
    content.append(
        create_paragraph(
            "%s (%s)" % (mandate.assistant.person, mandate.academic_year),
            get_administrative_data(mandate),
            styles['StandardWithBorder']
        )
    )
    content.append(create_paragraph("%s" % (_('entities')), get_entities(mandate), styles['StandardWithBorder']))
    content.append(create_paragraph("<strong>%s</strong>" % (_('absences')), get_absences(mandate),
                                    styles['StandardWithBorder']))
    content.append(create_paragraph("<strong>%s</strong>" % (_('comment')), get_comment(mandate),
                                    styles['StandardWithBorder']))
    content.append(PageBreak())
    if mandate.assistant_type == assistant_type.ASSISTANT:
        content.append(create_paragraph("%s" % (_('doctorate')), get_phd_data(mandate.assistant),
                                        styles['StandardWithBorder']))
        content.append(create_paragraph("%s" % (_('research')), get_research_data(mandate),
                                        styles['StandardWithBorder']))
        content.append(PageBreak())
    content.append(create_paragraph("%s<br />" % (_('tutoring_learning_units')), '', styles["BodyText"]))
    write_table(content, get_tutoring_learning_unit_year(mandate, styles['Tiny']), COLS_WIDTH_FOR_TUTORING)
    content.append(PageBreak())
    content.append(create_paragraph("%s" % (_('representation_activities')), get_representation_activities(mandate),
                                    styles['StandardWithBorder'], " (%s)" % (_('hours_per_year'))))
    content.append(create_paragraph("%s" % (_('service_activities')), get_service_activities(mandate),
                                    styles['StandardWithBorder'], " (%s)" % (_('hours_per_year'))))
    content.append(create_paragraph("%s" % (_('formation_activities')), get_formation_activities(mandate),
                                    styles['StandardWithBorder']))
    content.append(PageBreak())
    content.append(create_paragraph("%s" % (_('summary')), get_summary(mandate), styles['StandardWithBorder']))
    content += [draw_time_repartition(mandate)]
    content.append(PageBreak())
    if current_user_role is not user_role.ASSISTANT:
        content.append(create_paragraph("%s<br />" % (_('reviews')), '', styles["BodyText"]))
        if current_user_role is user_role.ADMINISTRATOR:
            reviews = review.find_by_mandate(mandate.id)
        else:
            reviews = find_before_mandate_state(mandate, current_user_role)
        for rev in reviews:
            if rev.status == review_status.IN_PROGRESS:
                break
            content.append(create_paragraph(
                str(_(rev.advice)),
                get_review_details_for_mandate(mandate, rev),
                styles['StandardWithBorder'])
            )
        content.append(PageBreak())
Exemplo n.º 8
0
def get_reviews_for_mandate(mandate, style):
    data = generate_headers(
        ['reviewer', 'review', 'remark', 'justification', 'confidential'],
        style)
    reviews = review.find_by_mandate(mandate.id)
    for rev in reviews:
        if rev.status == review_status.IN_PROGRESS:
            break
        if rev.reviewer is None:
            supervisor = "<br/>(%s)" % (str(_('supervisor')))
            person = mandate.assistant.supervisor.first_name + " " + mandate.assistant.supervisor.last_name + supervisor
        else:
            entity = entity_version.get_last_version(
                rev.reviewer.entity).acronym
            person = rev.reviewer.person.first_name + " " + rev.reviewer.person.last_name + "<br/>(" + entity + ")"
        data.append([
            Paragraph(person, style),
            Paragraph(_(rev.advice), style),
            Paragraph(rev.remark or '', style),
            Paragraph(rev.justification or '', style),
            Paragraph(rev.confidential or '', style)
        ])
    return data
def reviews_view(request, mandate_id):
    mandate = assistant_mandate.find_mandate_by_id(mandate_id)
    reviews = review.find_by_mandate(mandate.id)
    return render(request, 'mandate_reviews_view.html', {'reviews': reviews})
Exemplo n.º 10
0
def reviews_view(request, mandate_id):
    mandate = assistant_mandate.find_mandate_by_id(mandate_id)
    reviews = review.find_by_mandate(mandate.id)
    return render(request, 'mandate_reviews_view.html', {'reviews': reviews})
Exemplo n.º 11
0
def add_mandate_content(content: List[Union[Paragraph, PageBreak]],
                        mandate: assistant_mandate.AssistantMandate,
                        styles: StyleSheet1,
                        current_user_roles: List[str]) -> None:
    content.append(
        create_paragraph(
            "%s (%s)" % (mandate.assistant.person, mandate.academic_year),
            get_administrative_data(mandate), styles['StandardWithBorder']))
    content.append(
        create_paragraph("%s" % (_('Entities')), get_entities(mandate),
                         styles['StandardWithBorder']))
    content.append(
        create_paragraph("<strong>%s</strong>" % (_('Absences')),
                         get_absences(mandate), styles['StandardWithBorder']))
    content.append(
        create_paragraph("<strong>%s</strong>" % (_('Comment')),
                         get_comment(mandate), styles['StandardWithBorder']))
    content.append(PageBreak())
    if mandate.assistant_type == assistant_type.ASSISTANT:
        content.append(
            create_paragraph("%s" % (_('Ph.D.')),
                             get_phd_data(mandate.assistant),
                             styles['StandardWithBorder']))
        content.append(
            create_paragraph("%s" % (_('Research')),
                             get_research_data(mandate),
                             styles['StandardWithBorder']))
        content.append(PageBreak())
    content.append(
        create_paragraph("%s<br />" % (_('Course units')), '',
                         styles["BodyText"]))
    write_table(content,
                get_tutoring_learning_unit_year(mandate, styles['Tiny']),
                COLS_WIDTH_FOR_TUTORING)
    content.append(PageBreak())
    content.append(
        create_paragraph("%s" % (_('Representation activities at UCL')),
                         get_representation_activities(mandate),
                         styles['StandardWithBorder'],
                         " (%s)" % (_('number of hours per year'))))
    content.append(
        create_paragraph("%s" % (_('Service activities')),
                         get_service_activities(mandate),
                         styles['StandardWithBorder'],
                         " (%s)" % (_('number of hours per year'))))
    content.append(
        create_paragraph("%s" % (_('Training activities')),
                         get_formation_activities(mandate),
                         styles['StandardWithBorder']))
    content.append(PageBreak())
    content.append(
        create_paragraph("%s" % (_('Summary')), get_summary(mandate),
                         styles['StandardWithBorder']))
    content += [draw_time_repartition(mandate)]
    content.append(PageBreak())
    if user_role.ASSISTANT not in current_user_roles:
        content.append(
            create_paragraph("%s<br />" % (_('Opinions')), '',
                             styles["BodyText"]))
        if user_role.ADMINISTRATOR in current_user_roles:
            reviews = review.find_by_mandate(mandate.id)
        else:
            reviews = find_before_mandate_state(mandate, current_user_roles)
        for rev in reviews:
            if rev.status == review_status.IN_PROGRESS:
                break
            content.append(
                create_paragraph(str(_(rev.advice)),
                                 get_review_details_for_mandate(mandate, rev),
                                 styles['StandardWithBorder']))
        content.append(PageBreak())
Exemplo n.º 12
0
def add_mandate_content(content, mandate, styles, current_user_role):
    content.append(
        create_paragraph(
            "%s (%s)" % (mandate.assistant.person, mandate.academic_year),
            get_administrative_data(mandate), styles['StandardWithBorder']))
    content.append(
        create_paragraph("%s" % (_('entities')), get_entities(mandate),
                         styles['StandardWithBorder']))
    content.append(
        create_paragraph("<strong>%s</strong>" % (_('absences')),
                         get_absences(mandate), styles['StandardWithBorder']))
    content.append(
        create_paragraph("<strong>%s</strong>" % (_('comment')),
                         get_comment(mandate), styles['StandardWithBorder']))
    content.append(PageBreak())
    if mandate.assistant_type == assistant_type.ASSISTANT:
        content.append(
            create_paragraph("%s" % (_('doctorate')),
                             get_phd_data(mandate.assistant),
                             styles['StandardWithBorder']))
        content.append(
            create_paragraph("%s" % (_('research')),
                             get_research_data(mandate),
                             styles['StandardWithBorder']))
        content.append(PageBreak())
    content.append(
        create_paragraph("%s<br />" % (_('tutoring_learning_units')), '',
                         styles["BodyText"]))
    write_table(content,
                get_tutoring_learning_unit_year(mandate, styles['Tiny']),
                COLS_WIDTH_FOR_TUTORING)
    content.append(PageBreak())
    content.append(
        create_paragraph("%s" % (_('representation_activities')),
                         get_representation_activities(mandate),
                         styles['StandardWithBorder'],
                         " (%s)" % (_('hours_per_year'))))
    content.append(
        create_paragraph("%s" % (_('service_activities')),
                         get_service_activities(mandate),
                         styles['StandardWithBorder'],
                         " (%s)" % (_('hours_per_year'))))
    content.append(
        create_paragraph("%s" % (_('formation_activities')),
                         get_formation_activities(mandate),
                         styles['StandardWithBorder']))
    content.append(PageBreak())
    content.append(
        create_paragraph("%s" % (_('summary')), get_summary(mandate),
                         styles['StandardWithBorder']))
    content += [draw_time_repartition(mandate)]
    content.append(PageBreak())
    if current_user_role is not user_role.ASSISTANT:
        content.append(
            create_paragraph("%s<br />" % (_('reviews')), '',
                             styles["BodyText"]))
        if current_user_role is user_role.ADMINISTRATOR:
            reviews = review.find_by_mandate(mandate.id)
        else:
            reviews = find_before_mandate_state(mandate, current_user_role)
        for rev in reviews:
            if rev.status == review_status.IN_PROGRESS:
                break
            content.append(
                create_paragraph(str(_(rev.advice)),
                                 get_review_details_for_mandate(mandate, rev),
                                 styles['StandardWithBorder']))
        content.append(PageBreak())
Exemplo n.º 13
0
def reviews_view(request):
    mandate = assistant_mandate.find_mandate_by_assistant_for_academic_year(
        academic_assistant.find_by_person(request.user.person),
        academic_year.current_academic_year())
    reviews = review.find_by_mandate(mandate.id)
    return render(request, 'mandate_reviews_view.html', {'reviews': reviews})