def pst_form_view(request): mandate_id = request.POST.get("mandate_id") mandate = assistant_mandate.find_mandate_by_id(mandate_id) current_role = reviewer_role.PHD_SUPERVISOR current_person = request.user.person learning_units = tutoring_learning_unit_year.find_by_mandate(mandate) assistant = mandate.assistant entities = get_entities_for_mandate(mandate) phd_files = assistant_document_file.find_by_assistant_mandate_and_description( mandate, document_type.PHD_DOCUMENT) research_files = assistant_document_file.find_by_assistant_mandate_and_description( mandate, document_type.RESEARCH_DOCUMENT) tutoring_files = assistant_document_file.find_by_assistant_mandate_and_description( mandate, document_type.TUTORING_DOCUMENT) menu = generate_phd_supervisor_menu_tabs(mandate, None) return render( request, 'pst_form_view.html', { 'menu': menu, 'mandate_id': mandate.id, 'assistant': assistant, 'mandate': mandate, 'learning_units': learning_units, 'current_person': current_person, 'phd_files': phd_files, 'entities': entities, 'research_files': research_files, 'tutoring_files': tutoring_files, 'role': current_role, 'assistant_mandate_renewal': assistant_mandate_renewal, 'menu_type': 'phd_supervisor_menu', 'year': mandate.academic_year.year + 1 })
def pst_form_view(request): mandate_id = request.POST.get("mandate_id") mandate = assistant_mandate.find_mandate_by_id(mandate_id) current_reviewer = reviewer.Reviewer.objects.filter( person=request.user.person, entity__mandateentity__assistant_mandate=mandate ).first() current_role = current_reviewer.role entity = entity_version.get_last_version(current_reviewer.entity) entities = get_entities_for_mandate(mandate) learning_units = tutoring_learning_unit_year.find_by_mandate(mandate) phd_files = assistant_document_file.find_by_assistant_mandate_and_description(mandate, document_type.PHD_DOCUMENT) research_files = assistant_document_file.find_by_assistant_mandate_and_description(mandate, document_type.RESEARCH_DOCUMENT) tutoring_files = assistant_document_file.find_by_assistant_mandate_and_description(mandate, document_type.TUTORING_DOCUMENT) assistant = mandate.assistant menu = generate_reviewer_menu_tabs(current_role, mandate, None) return render(request, 'pst_form_view.html', {'menu': menu, 'menu_type': 'reviewer_menu', 'mandate_id': mandate.id, 'assistant': assistant, 'mandate': mandate, 'learning_units': learning_units, 'entity': entity, 'entities': entities, 'phd_files': phd_files, 'assistant_mandate_renewal': assistant_mandate_renewal, 'research_files': research_files, 'tutoring_files': tutoring_files, 'current_reviewer': current_reviewer, 'role': current_role, 'year': mandate.academic_year.year + 1})
def pst_form_view(request): mandate_id = request.POST.get("mandate_id") mandate = assistant_mandate.find_mandate_by_id(mandate_id) current_reviewer = reviewer.find_by_person(request.user.person) current_role = current_reviewer.role entity = entity_version.get_last_version(current_reviewer.entity) entities = get_entities_for_mandate(mandate) learning_units = tutoring_learning_unit_year.find_by_mandate(mandate) phd_files = assistant_document_file.find_by_assistant_mandate_and_description(mandate, document_type.PHD_DOCUMENT) research_files = assistant_document_file.find_by_assistant_mandate_and_description(mandate, document_type.RESEARCH_DOCUMENT) tutoring_files = assistant_document_file.find_by_assistant_mandate_and_description(mandate, document_type.TUTORING_DOCUMENT) assistant = mandate.assistant menu = generate_reviewer_menu_tabs(current_role, mandate, None) return render(request, 'pst_form_view.html', {'menu': menu, 'menu_type': 'reviewer_menu', 'mandate_id': mandate.id, 'assistant': assistant, 'mandate': mandate, 'learning_units': learning_units, 'entity': entity, 'entities': entities, 'phd_files': phd_files, 'assistant_mandate_renewal': assistant_mandate_renewal, 'research_files': research_files, 'tutoring_files': tutoring_files, 'current_reviewer': current_reviewer, 'role': current_role, 'year': mandate.academic_year.year + 1})
def get_tutoring_learning_unit_year(mandate, style): data = generate_headers([ 'tutoring_learning_units', 'academic_year', 'sessions_number', 'sessions_duration', 'series_number', 'face_to_face_duration', 'attendees', 'exams_supervision_duration', 'others_delivery' ], style) tutoring_learning_units_year = tutoring_learning_unit_year.find_by_mandate( mandate) for this_tutoring_learning_unit_year in tutoring_learning_units_year: academic_year = str( this_tutoring_learning_unit_year.learning_unit_year.academic_year) data.append([ Paragraph( this_tutoring_learning_unit_year.learning_unit_year. complete_title + " (" + this_tutoring_learning_unit_year.learning_unit_year.acronym + ")", style), Paragraph(academic_year, style), Paragraph(str(this_tutoring_learning_unit_year.sessions_number), style), Paragraph(str(this_tutoring_learning_unit_year.sessions_duration), style), Paragraph(str(this_tutoring_learning_unit_year.series_number), style), Paragraph( str(this_tutoring_learning_unit_year.face_to_face_duration), style), Paragraph(str(this_tutoring_learning_unit_year.attendees), style), Paragraph( str(this_tutoring_learning_unit_year.exams_supervision_duration ), style), Paragraph(this_tutoring_learning_unit_year.others_delivery or '', style) ]) return data
def test_retrieve_learning_units_year_from_previous_mandate(self): self.assistant_mandate3 = AssistantMandateFactory(assistant=self.assistant2) self.assistant_mandate2 = AssistantMandateFactory( assistant=self.assistant1, academic_year=self.previous_academic_year ) self.tutoring_learning_unit_year1 = TutoringLearningUnitYearFactory(mandate=self.assistant_mandate2) self.tutoring_learning_unit_year2 = TutoringLearningUnitYearFactory(mandate=self.assistant_mandate2) self.assistant_mandate5 = AssistantMandateFactory( assistant=self.assistant2 ) retrieve_learning_units_year_from_previous_mandate(self.assistant1, self.assistant_mandate1) self.assertEqual(len(find_by_mandate(self.assistant_mandate1)), 2) retrieve_learning_units_year_from_previous_mandate(self.assistant2, self.assistant_mandate5) self.assertEqual(len(find_by_mandate(self.assistant_mandate5)), 0) retrieve_learning_units_year_from_previous_mandate(self.assistant2, self.assistant_mandate3) self.assertEqual(len(find_by_mandate(self.assistant_mandate3)), 0)
def test_get_tutoring_learning_unit_year(self): style = self.styles['Tiny'] data = export_utils_pdf.generate_headers([ 'Course units', 'Academic year', 'Number of sessions planned for this course', 'Duration of a session (h)', 'Number of series', 'Number of face-to-face hours', 'Number of students per series', 'Preparation, coordination and evaluation (h)', 'Other types of services associated with this course' ], style) tutoring_learning_units_year = tutoring_learning_unit_year.find_by_mandate( self.mandate) for this_tutoring_learning_unit_year in tutoring_learning_units_year: academic_year = str(this_tutoring_learning_unit_year. learning_unit_year.academic_year) data.append([ Paragraph( this_tutoring_learning_unit_year.learning_unit_year. complete_title + " (" + this_tutoring_learning_unit_year.learning_unit_year.acronym + ")", style), Paragraph(academic_year, style), Paragraph( str(this_tutoring_learning_unit_year.sessions_number), style), Paragraph( str(this_tutoring_learning_unit_year.sessions_duration), style), Paragraph(str(this_tutoring_learning_unit_year.series_number), style), Paragraph( str(this_tutoring_learning_unit_year.face_to_face_duration ), style), Paragraph(str(this_tutoring_learning_unit_year.attendees), style), Paragraph( str(this_tutoring_learning_unit_year. exams_supervision_duration), style), Paragraph( this_tutoring_learning_unit_year.others_delivery or '', style) ]) self.assertEqual( str(data), str( export_utils_pdf.get_tutoring_learning_unit_year( self.mandate, style)))
def test_get_tutoring_learning_unit_year(self): style = self.styles['Tiny'] data = export_utils_pdf.generate_headers([ 'tutoring_learning_units', 'academic_year', 'sessions_number', 'sessions_duration', 'series_number', 'face_to_face_duration', 'attendees', 'exams_supervision_duration', 'others_delivery' ], style) tutoring_learning_units_year = tutoring_learning_unit_year.find_by_mandate( self.mandate) for this_tutoring_learning_unit_year in tutoring_learning_units_year: academic_year = str(this_tutoring_learning_unit_year. learning_unit_year.academic_year) data.append([ Paragraph( this_tutoring_learning_unit_year.learning_unit_year. complete_title + " (" + this_tutoring_learning_unit_year.learning_unit_year.acronym + ")", style), Paragraph(academic_year, style), Paragraph( str(this_tutoring_learning_unit_year.sessions_number), style), Paragraph( str(this_tutoring_learning_unit_year.sessions_duration), style), Paragraph(str(this_tutoring_learning_unit_year.series_number), style), Paragraph( str(this_tutoring_learning_unit_year.face_to_face_duration ), style), Paragraph(str(this_tutoring_learning_unit_year.attendees), style), Paragraph( str(this_tutoring_learning_unit_year. exams_supervision_duration), style), Paragraph( this_tutoring_learning_unit_year.others_delivery or '', style) ]) self.assertEqual( str(data), str( export_utils_pdf.get_tutoring_learning_unit_year( self.mandate, style)))
def get_tutoring_learning_unit_year(mandate, style): data = generate_headers([ 'tutoring_learning_units', 'academic_year', 'sessions_number', 'sessions_duration', 'series_number', 'face_to_face_duration', 'attendees', 'exams_supervision_duration', 'others_delivery' ], style) tutoring_learning_units_year = tutoring_learning_unit_year.find_by_mandate(mandate) for this_tutoring_learning_unit_year in tutoring_learning_units_year: academic_year = str(this_tutoring_learning_unit_year.learning_unit_year.academic_year) data.append([Paragraph(this_tutoring_learning_unit_year.learning_unit_year.complete_title + " (" + this_tutoring_learning_unit_year.learning_unit_year.acronym + ")", style), Paragraph(academic_year, style), Paragraph(str(this_tutoring_learning_unit_year.sessions_number), style), Paragraph(str(this_tutoring_learning_unit_year.sessions_duration), style), Paragraph(str(this_tutoring_learning_unit_year.series_number), style), Paragraph(str(this_tutoring_learning_unit_year.face_to_face_duration), style), Paragraph(str(this_tutoring_learning_unit_year.attendees), style), Paragraph(str(this_tutoring_learning_unit_year.exams_supervision_duration), style), Paragraph(this_tutoring_learning_unit_year.others_delivery[0:3500] or '', style) ]) return data
def assistant_form_view(request, mandate_id): mandate = assistant_mandate.find_mandate_by_id(mandate_id) learning_units = tutoring_learning_unit_year.find_by_mandate(mandate) phd_files = assistant_document_file.find_by_assistant_mandate_and_description( mandate, document_type.PHD_DOCUMENT) research_files = assistant_document_file.find_by_assistant_mandate_and_description( mandate, document_type.RESEARCH_DOCUMENT) tutoring_files = assistant_document_file.find_by_assistant_mandate_and_description( mandate, document_type.TUTORING_DOCUMENT) return render( request, 'manager_assistant_form_view.html', { 'mandate_id': mandate_id, 'assistant': mandate.assistant, 'mandate': mandate, 'learning_units': learning_units, 'phd_files': phd_files, 'assistant_mandate_renewal': assistant_mandate_renewal, 'research_files': research_files, 'tutoring_files': tutoring_files, 'year': mandate.academic_year.year + 1, 'assistant_type': assistant_type })
def get_tutoring_learning_unit_year(mandate, style): data = generate_headers([ 'Course units', 'Academic year', 'Number of sessions planned for this course', 'Duration of a session (h)', 'Number of series', 'Number of face-to-face hours', 'Number of students per series', 'Preparation, coordination and evaluation (h)', 'Other types of services associated with this course' ], style) tutoring_learning_units_year = tutoring_learning_unit_year.find_by_mandate( mandate) for this_tutoring_learning_unit_year in tutoring_learning_units_year: academic_year = str( this_tutoring_learning_unit_year.learning_unit_year.academic_year) data.append([ Paragraph( this_tutoring_learning_unit_year.learning_unit_year. complete_title + " (" + this_tutoring_learning_unit_year.learning_unit_year.acronym + ")", style), Paragraph(academic_year, style), Paragraph(str(this_tutoring_learning_unit_year.sessions_number), style), Paragraph(str(this_tutoring_learning_unit_year.sessions_duration), style), Paragraph(str(this_tutoring_learning_unit_year.series_number), style), Paragraph( str(this_tutoring_learning_unit_year.face_to_face_duration), style), Paragraph(str(this_tutoring_learning_unit_year.attendees), style), Paragraph( str(this_tutoring_learning_unit_year.exams_supervision_duration ), style), Paragraph( this_tutoring_learning_unit_year.others_delivery[0:3500] or '', style) ]) return data
def get_queryset(self): mandate = assistant_mandate.find_mandate_by_assistant_for_academic_year( academic_assistant.find_by_person(self.request.user.person), academic_year.current_academic_year()) queryset = tutoring_learning_unit_year.find_by_mandate(mandate) return queryset
def get_queryset(self): mandate = assistant_mandate.find_mandate_by_assistant_for_academic_year( academic_assistant.find_by_person(self.request.user.person), academic_year.current_academic_year()) queryset = tutoring_learning_unit_year.find_by_mandate(mandate) return queryset