def _get_list_sessions_exam_deadlines(academic_calendar, offer_year): session_exam_deadlines = [] number_session = session_exam_calendar.get_number_session_by_academic_calendar(academic_calendar) if number_session: session_exam_deadlines = SessionExamDeadline.objects.filter( offer_enrollment__offer_year=offer_year, number_session=number_session) else: msg = "No SessionExamCalendar (number session) found for academic calendar = {}" logger.warning(msg.format(academic_calendar.title)) return session_exam_deadlines
def _get_oyc_by_reference(off_year_calendar, reference): number_session = session_exam_calendar.get_number_session_by_academic_calendar(off_year_calendar.academic_calendar) if number_session: try: return offer_year_calendar.search(education_group_year=off_year_calendar.education_group_year, offer_year=off_year_calendar.offer_year, academic_calendar_reference=reference, number_session=number_session).get() except offer_year_calendar.OfferYearCalendar.DoesNotExist: return None
def _get_list_sessions_exam_deadlines(academic_calendar, offer_year): session_exam_deadlines = [] number_session = session_exam_calendar.get_number_session_by_academic_calendar(academic_calendar) if number_session: session_exam_deadlines = SessionExamDeadline.objects.filter( offer_enrollment__offer_year=offer_year, number_session=number_session) else: msg = "No SessionExamCalendar (number session) found for academic calendar = {}" logger.warning(msg.format(academic_calendar.title)) return session_exam_deadlines
def _get_oyc_by_reference(off_year_calendar, reference): number_session = session_exam_calendar.get_number_session_by_academic_calendar(off_year_calendar.academic_calendar) if number_session: try: return offer_year_calendar.search(education_group_year=off_year_calendar.education_group_year, offer_year=off_year_calendar.offer_year, academic_calendar_reference=reference, number_session=number_session).get() except offer_year_calendar.OfferYearCalendar.DoesNotExist: return None
def test_get_number_session_by_academic_calendar(self): SessionExamCalendarFactory(academic_calendar=self.academic_calendar_1, number_session=number_session.ONE) number = get_number_session_by_academic_calendar( self.academic_calendar_1) self.assertEqual(number, number_session.ONE)
def test_get_number_session_by_academic_calendar_empty(self): number = get_number_session_by_academic_calendar( self.academic_calendar_1) self.assertEqual(number, None)