Skip to content

Commit

Permalink
Fix/muwm 5350 (#3129)
Browse files Browse the repository at this point in the history
Resolve MUWM-5350
  • Loading branch information
fanglinfang authored Jul 23, 2024
1 parent db1b774 commit d8f0a56
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion myuw/dao/iasystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions myuw/dao/term.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion myuw/dao/visual_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
Expand Down
1 change: 1 addition & 0 deletions myuw/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -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"}},
Expand Down
12 changes: 10 additions & 2 deletions myuw/test/dao/test_term.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,20 +399,28 @@ 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)

self.assertEqual(context['year'], 2013)
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")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit d8f0a56

Please sign in to comment.