def test_find_session_exam_number_none(self): SessionExamCalendarFactory(academic_calendar=self.academic_calendar_1, number_session=number_session.TWO) self.assertIsNone( session_exam_calendar.find_session_exam_number( date=datetime.date(self.current_academic_yr.year + 1, 1, 5)))
def test_find_session_exam_number(self): SessionExamCalendarFactory(academic_calendar=self.academic_calendar_1, number_session=number_session.TWO) self.assertEqual( number_session.TWO, session_exam_calendar.find_session_exam_number( date=datetime.date(self.current_academic_yr.year, 11, 9)))
def get_scores_encoding_list(user, **kwargs): current_academic_year = academic_year.current_academic_year() current_number_session = session_exam_calendar.find_session_exam_number() is_program_manager = program_manager.is_program_manager(user) learning_unit_year_id = kwargs.get('learning_unit_year_id') offer_year_id = kwargs.get('offer_year_id') tutor_id = kwargs.get('tutor_id') enrollments_ids = kwargs.get('enrollments_ids') justification = kwargs.get('justification') only_enrolled = _need_to_filter_students_enrolled_to_exam( justification, kwargs) if is_program_manager: professor = tutor.find_by_id(tutor_id) if tutor_id else None offers_year = [offer_year.find_by_id(offer_year_id)] if offer_year_id else \ list(offer_year.find_by_user(user, academic_yr=current_academic_year)) enrollments = exam_enrollment.find_for_score_encodings( academic_year=current_academic_year, session_exam_number=current_number_session, learning_unit_year_id=learning_unit_year_id, tutor=professor, offers_year=offers_year, registration_id=kwargs.get('registration_id'), student_last_name=kwargs.get('student_last_name'), student_first_name=kwargs.get('student_first_name'), justification=justification, only_enrolled=only_enrolled, ) else: professor = tutor.find_by_user(user) enrollments = exam_enrollment.find_for_score_encodings( academic_year=current_academic_year, session_exam_number=current_number_session, learning_unit_year_id=learning_unit_year_id, tutor=professor, only_enrolled=only_enrolled) # Want a subset of exam enrollment list if enrollments_ids: enrollments = enrollments.filter(id__in=enrollments_ids) # Append deadline/deadline_tutor for each exam enrollments enrollments = _append_session_exam_deadline(list(enrollments)) enrollments = sort_encodings(enrollments) return ScoresEncodingList( **{ 'academic_year': current_academic_year, 'number_session': current_number_session, 'learning_unit_year': learning_unit_year.get_by_id(learning_unit_year_id ) if learning_unit_year_id else None, 'enrollments': enrollments })
def get_scores_encoding_list(user, **kwargs): current_academic_year = academic_year.current_academic_year() current_number_session = session_exam_calendar.find_session_exam_number() is_program_manager = program_manager.is_program_manager(user) learning_unit_year_id = kwargs.get('learning_unit_year_id') offer_year_id = kwargs.get('offer_year_id') tutor_id = kwargs.get('tutor_id') enrollments_ids = kwargs.get('enrollments_ids') justification = kwargs.get('justification') only_enrolled = _need_to_filter_students_enrolled_to_exam(justification, kwargs) if is_program_manager: professor = tutor.find_by_id(tutor_id) if tutor_id else None offers_year = [offer_year.find_by_id(offer_year_id)] if offer_year_id else \ list(offer_year.find_by_user(user, academic_yr=current_academic_year)) enrollments = exam_enrollment.find_for_score_encodings( academic_year=current_academic_year, session_exam_number=current_number_session, learning_unit_year_id=learning_unit_year_id, tutor=professor, offers_year=offers_year, registration_id=kwargs.get('registration_id'), student_last_name=kwargs.get('student_last_name'), student_first_name=kwargs.get('student_first_name'), justification=justification, only_enrolled=only_enrolled, ) else: professor = tutor.find_by_user(user) enrollments = exam_enrollment.find_for_score_encodings( academic_year=current_academic_year, session_exam_number=current_number_session, learning_unit_year_id=learning_unit_year_id, tutor=professor, only_enrolled=only_enrolled ) # Want a subset of exam enrollment list if enrollments_ids: enrollments = enrollments.filter(id__in=enrollments_ids) # Append deadline/deadline_tutor for each exam enrollments enrollments = _append_session_exam_deadline(list(enrollments)) enrollments = sort_encodings(enrollments) return ScoresEncodingList(**{ 'academic_year': current_academic_year, 'number_session': current_number_session, 'learning_unit_year': learning_unit_year.get_by_id(learning_unit_year_id) if learning_unit_year_id else None, 'enrollments': enrollments })