Skip to content

Commit

Permalink
Merge pull request #200 from uw-it-aca/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
fanglinfang committed Apr 20, 2023
2 parents 275e514 + 3be31fa commit 7af088e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions uw_sws/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,7 @@ def is_standby_status(self):
def is_withdrew(self):
return (WITHDREW_GRADE_PATTERN.match(self.grade) is not None)

def json_data(self, include_section=False):
def json_data(self, include_section_ref=False):
data = {
'credits': self.credits,
'duplicate_code': self.duplicate_code,
Expand All @@ -1100,8 +1100,8 @@ def json_data(self, include_section=False):
'is_withdrew': self.is_withdrew(),
'is_eos_only': self.eos_only(),
}
if include_section and self.section is not None:
data['section'] = self.section.json_data()
if include_section_ref and self.section_ref is not None:
data['section_ref'] = self.section_ref.json_data()
return data

def __str__(self):
Expand Down Expand Up @@ -1406,7 +1406,7 @@ def __init__(self, *args, **kwargs):
self.is_registered = len(registrations) > 0
for json_reg in registrations:
registration = Registration(data=json_reg)
registration.section = SectionReference(
registration.section_ref = SectionReference(
term=self.term,
curriculum_abbr=json_reg['Section']['CurriculumAbbreviation'],
course_number=json_reg['Section']['CourseNumber'],
Expand All @@ -1419,7 +1419,7 @@ def __init__(self, *args, **kwargs):
if (registration.start_date and registration.end_date and
self._is_src_location_pce(
metadata, REGISTRATION_SOURCE_PCE)):
key = registration.section.section_label()
key = registration.section_ref.section_label()
self.unf_pce_courses[key] = registration

for major in json_data.get('Majors', []):
Expand Down Expand Up @@ -1453,7 +1453,7 @@ def json_data(self):
'is_registered': self.is_registered,
'has_pending_major_change': self.has_pending_major_change,
'registrations': [r.json_data(
include_section=True) for r in self.registrations],
include_section_ref=True) for r in self.registrations],
'majors': [m.json_data() for m in self.majors],
'minors': [m.json_data() for m in self.minors],
'term': {'year': self.term.year, 'quarter': self.term.quarter},
Expand Down
8 changes: 4 additions & 4 deletions uw_sws/tests/test_enrollment.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ def test_offterm_enrolled_courses(self):
self.assertTrue(enrollment.is_registered)
self.assertEqual(len(enrollment.registrations), 2)
self.assertEqual(
enrollment.registrations[0].section.section_label(),
enrollment.registrations[0].section_ref.section_label(),
"2013,winter,COM,201/A")
self.assertEqual(
enrollment.registrations[1].section.section_label(),
enrollment.registrations[1].section_ref.section_label(),
"2013,winter,PSYCH,203/A")
self.assertTrue(enrollment.has_unfinished_pce_course())
self.assertEqual(len(enrollment.unf_pce_courses), 2)
Expand All @@ -95,7 +95,7 @@ def test_offterm_enrolled_courses(self):
self.assertFalse(reg1.is_pending_status())
self.assertTrue(len(reg1.json_data()) > 0)
self.assertEqual(
reg1.section.json_data(),
reg1.section_ref.json_data(),
{'course_number': u'201',
'curriculum_abbr': u'COM',
'quarter': u'winter',
Expand All @@ -113,7 +113,7 @@ def test_offterm_enrolled_courses(self):
self.assertEqual(reg2.meta_data,
"RegistrationSourceLocation=SDB_EOS;")
self.assertEqual(
reg2.section.json_data(),
reg2.section_ref.json_data(),
{'course_number': u'203',
'curriculum_abbr': u'PSYCH',
'quarter': u'winter',
Expand Down

0 comments on commit 7af088e

Please sign in to comment.