Skip to content

Commit

Permalink
add credit_control in Section
Browse files Browse the repository at this point in the history
  • Loading branch information
fanglinfang committed Jul 6, 2017
1 parent a54dd49 commit 8c4489f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
author="UW-IT AXDD",
author_email="aca-it@uw.edu",
include_package_data=True,
install_requires=['UW-RestClients-Core>=0.8.9,<1.0',
install_requires=['UW-RestClients-Core>=0.9,<1.0',
'UW-RestClients-PWS<1.0',
'mock',
'python-dateutil',
Expand Down
5 changes: 5 additions & 0 deletions uw_sws/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ class Section(models.Model):
course_title = models.CharField(max_length=20)
course_title_long = models.CharField(max_length=50)
course_campus = models.CharField(max_length=7)
credit_control = models.CharField(max_length=32, null=True)
section_type = models.CharField(max_length=30)
is_independent_study = models.NullBooleanField()
independent_study_instructor_regid = models.CharField(max_length=32,
Expand Down Expand Up @@ -583,6 +584,9 @@ def get_grade_date_str(self):
return str(self.grade_date)
return None

def for_credit(self):
return self.credit_control is not None

def is_summer_a_term(self):
return self.summer_term is not None and\
len(self.summer_term) > 0 and\
Expand Down Expand Up @@ -627,6 +631,7 @@ def json_data(self):
self.limit_estimate_enrollment_indicator,
'auditors': self.auditors,
'meetings': [],
'for-credit': self.for_credit(),
'credits': str(self.student_credits),
'is_auditor': self.is_auditor,
'grade': self.student_grade,
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"GradingSystem": "standard", "CourseTitle": "FIN PLAN AND PRAC", "Auditors": "0", "PrimarySection": {"CurriculumAbbreviation": "ELCBUS", "SectionID": "A", "Href": "/student/v5/course/2013,spring,ELCBUS,451/A.json", "Year": "2013", "Quarter": "spring", "CourseNumber": "451"}, "CourseDescription": "Emphasizes major current theories and practices in the field of financial management. Topics include financial ratio analysis; break-even analysis; cash, marketable securities, inventory, and accounts receivable management models; dividend policy; short-term and long-term financing decisions; and international finance. Prerequisite: minimum grade of 1.7 in ELCBUS 350.", "LimitEstimateEnrollmentIndicator": "limit", "Curriculum": {"TimeScheduleLinkAbbreviation": ""}, "HonorsCourse": false, "Term": {"Quarter": "spring", "Href": "/student/v5/term/2013,spring.json", "Year": "2013"}, "LimitEstimateEnrollment": "5", "CourseTitleLong": "FINANCIAL POLICY AND PLANNING", "DuplicateEnrollmentAllowed": false, "CourseCampus": "Bothell", "Registrations": {"CurriculumAbbreviation": "ELCBUS", "PageSize": null, "SectionID": "A", "InstructorRegID": null, "Href": "/student/v5/registration.json?year=2013&quarter=spring&curriculum_abbreviation=ELCBUS&course_number=451\u00a7ion_id=A\u00ae_id=&is_active=on&instructor_reg_id=", "Year": "2013", "RegID": null, "PageStart": null, "Quarter": "spring", "CourseNumber": "451", "IsActive": "on"}, "SLN": "11162", "LinkedSectionTypes": [], "ServiceLearning": false, "SectionType": "lecture", "SectionID": "A", "Meetings": [{"Building": "ELC", "MeetingIndex": "1", "RoomNumber": "EVEREST", "Instructors": [{"Person": {"RegID": "FBB38FE46A7C11D5A4AE0004AC494FFE", "Href": "/student/v5/person/FBB38FE46A7C11D5A4AE0004AC494FFE.json", "Name": "TEACHER, BILL AVERAGE"}, "TSPrint": true, "FacultySequenceNumber": "", "GradeRoster": {"Href": "/student/v5/graderoster/2013,spring,ELCBUS,451,A,FBB38FE46A7C11D5A4AE0004AC494FFE"}}], "DaysOfWeek": {"Text": "M W", "Days": [{"Name": "Monday"}, {"Name": "Wednesday"}]}, "MeetingType": "lecture", "RoomToBeArranged": false, "StartTime": "14:30", "DaysOfWeekToBeArranged": false, "EndTime": "19:00", "BuildingToBeArranged": false}], "DeleteFlag": "active", "GeneralEducationRequirements": {"NaturalWorld": false, "Writing": false, "QuantitativeAndSymbolicReasoning": false, "EnglishComposition": false, "IndividualsAndSocieties": false, "VisualLiteraryAndPerformingArts": false}, "springTerm": "A-term", "Course": {"CourseTitleLong": "FINANCIAL POLICY AND PLANNING", "CurriculumAbbreviation": "ELCBUS", "CourseTitle": "FIN PLAN AND PRAC", "Href": "/student/v5/course/2013,spring,ELCBUS,451.json", "Year": "2013", "Quarter": "spring", "CourseNumber": "451"}, "ResearchCredit": false, "GradeSubmissionDelegates": [{"DelegateLevel": "curriculum", "Person": {"RegID": "6DF0A9206A7D11D5A4AE0004AC494FFE", "Href": "/student/v5/person/6DF0A9206A7D11D5A4AE0004AC494FFE.json", "Name": "TEACHER, FRED AVERAGE"}}], "SecondaryGradingOption": false, "ClassWebsiteUrl": "", "CurrentEnrollment": "0"}
{"GradingSystem": "standard", "CourseTitle": "FIN PLAN AND PRAC", "Auditors": "0", "PrimarySection": {"CurriculumAbbreviation": "ELCBUS", "SectionID": "A", "Href": "/student/v5/course/2013,spring,ELCBUS,451/A.json", "Year": "2013", "Quarter": "spring", "CourseNumber": "451"}, "CourseDescription": "Emphasizes major current theories and practices in the field of financial management. Topics include financial ratio analysis; break-even analysis; cash, marketable securities, inventory, and accounts receivable management models; dividend policy; short-term and long-term financing decisions; and international finance. Prerequisite: minimum grade of 1.7 in ELCBUS 350.", "LimitEstimateEnrollmentIndicator": "limit", "Curriculum": {"TimeScheduleLinkAbbreviation": ""}, "HonorsCourse": false, "Term": {"Quarter": "spring", "Href": "/student/v5/term/2013,spring.json", "Year": "2013"}, "LimitEstimateEnrollment": "5", "CourseTitleLong": "FINANCIAL POLICY AND PLANNING", "DuplicateEnrollmentAllowed": false, "CourseCampus": "Bothell", "Registrations": {"CurriculumAbbreviation": "ELCBUS", "PageSize": null, "SectionID": "A", "InstructorRegID": null, "Href": "/student/v5/registration.json?year=2013&quarter=spring&curriculum_abbreviation=ELCBUS&course_number=451\u00a7ion_id=A\u00ae_id=&is_active=on&instructor_reg_id=", "Year": "2013", "RegID": null, "PageStart": null, "Quarter": "spring", "CourseNumber": "451", "IsActive": "on"}, "SLN": "11162", "LinkedSectionTypes": [], "ServiceLearning": false, "SectionType": "lecture", "SectionID": "A", "CreditControl": "zero credits", "Meetings": [{"Building": "ELC", "MeetingIndex": "1", "RoomNumber": "EVEREST", "Instructors": [{"Person": {"RegID": "FBB38FE46A7C11D5A4AE0004AC494FFE", "Href": "/student/v5/person/FBB38FE46A7C11D5A4AE0004AC494FFE.json", "Name": "TEACHER, BILL AVERAGE"}, "TSPrint": true, "FacultySequenceNumber": "", "GradeRoster": {"Href": "/student/v5/graderoster/2013,spring,ELCBUS,451,A,FBB38FE46A7C11D5A4AE0004AC494FFE"}}], "DaysOfWeek": {"Text": "M W", "Days": [{"Name": "Monday"}, {"Name": "Wednesday"}]}, "MeetingType": "lecture", "RoomToBeArranged": false, "StartTime": "14:30", "DaysOfWeekToBeArranged": false, "EndTime": "19:00", "BuildingToBeArranged": false}], "DeleteFlag": "active", "GeneralEducationRequirements": {"NaturalWorld": false, "Writing": false, "QuantitativeAndSymbolicReasoning": false, "EnglishComposition": false, "IndividualsAndSocieties": false, "VisualLiteraryAndPerformingArts": false}, "springTerm": "A-term", "Course": {"CourseTitleLong": "FINANCIAL POLICY AND PLANNING", "CurriculumAbbreviation": "ELCBUS", "CourseTitle": "FIN PLAN AND PRAC", "Href": "/student/v5/course/2013,spring,ELCBUS,451.json", "Year": "2013", "Quarter": "spring", "CourseNumber": "451"}, "ResearchCredit": false, "GradeSubmissionDelegates": [{"DelegateLevel": "curriculum", "Person": {"RegID": "6DF0A9206A7D11D5A4AE0004AC494FFE", "Href": "/student/v5/person/6DF0A9206A7D11D5A4AE0004AC494FFE.json", "Name": "TEACHER, FRED AVERAGE"}}], "SecondaryGradingOption": false, "ClassWebsiteUrl": "", "CurrentEnrollment": "0"}
1 change: 1 addition & 0 deletions uw_sws/section.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ def _json_to_section(section_data,
section.lms_ownership = section_data.get("LMSOwnership", None)
section.is_independent_start = section_data.get("IsIndependentStart",
False)
section.credit_control = section_data.get("CreditControl", "")

if "StartDate" in section_data and\
len(section_data["StartDate"]) > 0:
Expand Down
10 changes: 10 additions & 0 deletions uw_sws/tests/test_section.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,3 +530,13 @@ def test_normalized_meeting_time(self):
jd = section.meetings[0].json_data()
self.assertEqual(jd['start_time'], '18:00')
self.assertEqual(jd['end_time'], '21:00')

def test_for_credit_course(self):
section = get_section_by_label('2013,spring,ESS,107/A')
self.assertFalse(section.for_credit())
section = get_section_by_label('2013,winter,COM,201/A')
self.assertTrue(section.for_credit())
section = get_section_by_label('2013,spring,ELCBUS,451/A')
self.assertTrue(section.for_credit())
section = get_section_by_label('2013,spring,TRAIN,100/A')
self.assertTrue(section.for_credit())

0 comments on commit 8c4489f

Please sign in to comment.