diff --git a/myuw/dao/iasystem.py b/myuw/dao/iasystem.py index 523f99980..4df4ab19d 100644 --- a/myuw/dao/iasystem.py +++ b/myuw/dao/iasystem.py @@ -69,7 +69,7 @@ def summer_term_overlaped(request, given_section): current summer term in the request """ current_summer_term = get_current_summer_term(request) - if given_section is None or current_summer_term is None: + if given_section is None or not current_summer_term: return True return (given_section.is_same_summer_term(current_summer_term) or given_section.is_full_summer_term() and diff --git a/myuw/dao/term.py b/myuw/dao/term.py index 68949fd95..839d0cfb7 100644 --- a/myuw/dao/term.py +++ b/myuw/dao/term.py @@ -307,9 +307,9 @@ def get_current_summer_term(request): or None if it is not a summer quarter """ if not is_in_summer_quarter(request): - return None - eod_aterm = get_current_quarter(request).get_eod_summer_aterm() - if get_comparison_datetime(request) > eod_aterm: + return "" # MUWM-5350 empty string + bterm_first_date = get_current_quarter(request).bterm_first_date + if get_comparison_date(request) >= bterm_first_date: return "b-term" else: return "a-term" @@ -526,6 +526,7 @@ def add_term_data_to_context(request, context): compare <= cur_term.last_final_exam_date): context['is_finals'] = True + context['summer_term'] = get_current_summer_term(request) context['first_day'] = cur_term.first_day_quarter context['last_day'] = cur_term.last_day_instruction context["first_day_quarter"] = cur_term.first_day_quarter diff --git a/myuw/dao/visual_schedule.py b/myuw/dao/visual_schedule.py index b9538d8da..927df4ca4 100644 --- a/myuw/dao/visual_schedule.py +++ b/myuw/dao/visual_schedule.py @@ -4,7 +4,6 @@ import logging from myuw.dao.registration import get_schedule_by_term from myuw.dao.instructor_schedule import get_instructor_schedule_by_term -from myuw.dao.term import get_current_quarter, get_current_summer_term from myuw.dao.campus_building import get_building_by_code from restclients_core.exceptions import DataFailureException from dateutil.relativedelta import * diff --git a/myuw/templates/base.html b/myuw/templates/base.html index fc720d264..3eb2bfd19 100644 --- a/myuw/templates/base.html +++ b/myuw/templates/base.html @@ -74,6 +74,7 @@ today: '{{ today|date:"l, F j, Y" }}', year: '{{ year }}', quarter: '{{ quarter }}', + summerTerm: '{{ summer_term }}', breakYear: '{{ break_year }}', breakQuarter: '{{ break_quarter }}', isFinals: {{ is_finals|yesno:"true, false"}}, diff --git a/myuw/test/dao/test_term.py b/myuw/test/dao/test_term.py index 10c995ef6..a96e49756 100644 --- a/myuw/test/dao/test_term.py +++ b/myuw/test/dao/test_term.py @@ -399,7 +399,6 @@ def test_get_current_and_next_quarters(self): def test_term_data_context_in_quarter(self): request = get_request_with_date("2013-03-10") - context = {} add_term_data_to_context(request, context) @@ -407,12 +406,21 @@ def test_term_data_context_in_quarter(self): self.assertEqual(context['quarter'], 'winter') self.assertEqual(context['is_finals'], False) self.assertEqual(context['is_break'], False) - + self.assertEqual(context['summer_term'], "") self.assertEqual(context['today'].year, 2013) self.assertEqual(context['today'].month, 3) self.assertEqual(context['today'].day, 10) self.assertEqual(context['future_term'], "2013,spring") + request = get_request_with_date("2013-07-10") + context = {} + add_term_data_to_context(request, context) + self.assertEqual(context['summer_term'], "a-term") + request = get_request_with_date("2013-07-25") + context = {} + add_term_data_to_context(request, context) + self.assertEqual(context['summer_term'], "b-term") + def test_term_data_context_in_finals(self): request = get_request_with_date("2013-03-22") diff --git a/myuw_vue/components/_common/course/student/course-cards.vue b/myuw_vue/components/_common/course/student/course-cards.vue index 9fa32dfc7..97c80a6d9 100644 --- a/myuw_vue/components/_common/course/student/course-cards.vue +++ b/myuw_vue/components/_common/course/student/course-cards.vue @@ -44,7 +44,7 @@ export default { ...mapState({ student: (state) => state.user.affiliations.student, quarter: (state) => state.termData.quarter, - summerTerm: (state) => state.termData.summer_term, + summerTerm: (state) => state.termData.summerTerm, }), ...mapState('stud_schedule', { course(state) {