Beispiel #1
0
 def test_handles_multiple_locations_and_instructors(self, app):
     section = get_sis_section('2178', 90200)
     assert section['meetings'][0]['days'] == 'Tue, Thu'
     assert section['meetings'][0]['time'] == '6:00 pm - 6:59 pm'
     assert section['meetings'][0]['location'] == 'Dwinelle 117'
     assert section['meetings'][0]['instructors'] == ['Johan Huizinga', 'Ernst Robert Curtius']
     assert section['meetings'][1]['days'] == 'Wednesday'
     assert section['meetings'][1]['time'] == '1:30 pm - 2:59 pm'
     assert section['meetings'][1]['location'] == 'Campbell Hall 501B'
     assert section['meetings'][1]['instructors'] == ['Johan Huizinga', 'Ernst Robert Curtius']
Beispiel #2
0
 def test_get_section(self, app):
     section_id = 90100
     section = get_sis_section('2178', section_id)
     assert section['sectionId'] == section_id
     assert section['displayName'] == 'BURMESE 1A'
     assert section['title'] == 'Introductory Burmese'
     assert section['units'] == 4
     assert section['meetings'][0]['days'] == 'M, T, W, Th, F'
     assert section['meetings'][0]['instructors'] == ['George Orwell']
     assert section['meetings'][0]['time'] == '12:00 pm - 12:59 pm'
     assert section['meetings'][0]['location'] == 'Wheeler 999'
Beispiel #3
0
def get_section(term_id, section_id):
    offset = util.get(request.args, 'offset', None)
    if offset:
        offset = int(offset)
    limit = util.get(request.args, 'limit', None)
    if limit:
        limit = int(limit)
    section = get_sis_section(term_id, section_id)
    if not section:
        raise ResourceNotFoundError(f'No section {section_id} in term {term_id}')
    student_profiles = get_course_student_profiles(term_id, section_id, offset=offset, limit=limit)
    section.update(student_profiles)
    Alert.include_alert_counts_for_students(viewer_uid=current_user.uid, cohort=student_profiles)
    return tolerant_jsonify(section)
def get_section(term_id, section_id):
    if not current_user.can_access_canvas_data:
        raise ForbiddenRequestError('Unauthorized to view course data')
    offset = util.get(request.args, 'offset', None)
    if offset:
        offset = int(offset)
    limit = util.get(request.args, 'limit', None)
    if limit:
        limit = int(limit)
    featured = util.get(request.args, 'featured', None)
    section = get_sis_section(term_id, section_id)
    if not section:
        raise ResourceNotFoundError(f'No section {section_id} in term {term_id}')
    student_profiles = get_course_student_profiles(term_id, section_id, offset=offset, limit=limit, featured=featured)
    section.update(student_profiles)
    Alert.include_alert_counts_for_students(viewer_user_id=current_user.get_id(), group=student_profiles)
    return tolerant_jsonify(section)
Beispiel #5
0
 def test_handles_eap_courses(self, app):
     section_id = 98000
     rows = [
         'sis_term_id,sis_section_id,sis_course_title,sis_course_name,is_primary,sis_instruction_format,'
         'sis_section_num,allowed_units,instructor_uid,instructor_name,instructor_role_code,'
         'meeting_location,meeting_days,meeting_start_time,meeting_end_time,meeting_start_date,meeting_end_date',
         '2178,98000,Rabelais en Indre-et-Loire,EAPFRENCH 1998,true,LEC,001,22.0,'
         ',,,,,,2017-08-23 00:00:00 UTC,2017-12-08 00:00:00 UTC',
     ]
     mr = MockRows(io.StringIO('\n'.join(rows)))
     with register_mock(data_loch.get_sis_section, mr):
         section = get_sis_section('2178', section_id)
         assert section['sectionId'] == section_id
         assert section['displayName'] == 'EAPFRENCH 1998'
         assert section['title'] == 'Rabelais en Indre-et-Loire'
         assert section['units'] is None
         assert section['meetings'][0]['days'] is None
         assert section['meetings'][0]['time'] is None
         assert section['meetings'][0]['location'] is None
         assert section['meetings'][0]['instructors'] == []
Beispiel #6
0
 def test_handles_online_courses(self, app):
     section_id = 99000
     rows = [
         'sis_term_id,sis_section_id,sis_course_title,sis_course_name,is_primary,sis_instruction_format,'
         'sis_section_num,allowed_units,instructor_uid,instructor_name,instructor_role_code,'
         'meeting_location,meeting_days,meeting_start_time,meeting_end_time,meeting_start_date,meeting_end_date',
         '2178,99000,MedXieval Dead,MED ST 1999,true,ONL,001,86.0,'
         '9922330,Hal Colossus,PI,,,,2017-08-23 00:00:00 UTC,2017-12-08 00:00:00 UTC',
         # Also include an empty instructor row, since they sometimes show up.
         '2178,99000,MedXieval Dead,MED ST 1999,true,ONL,001,86.0,'
         '9922330,,APRX,,,,2017-08-23 00:00:00 UTC,2017-12-08 00:00:00 UTC',
     ]
     mr = MockRows(io.StringIO('\n'.join(rows)))
     with register_mock(data_loch.get_sis_section, mr):
         section = get_sis_section('2178', section_id)
         assert section['sectionId'] == section_id
         assert section['displayName'] == 'MED ST 1999'
         assert section['title'] == 'MedXieval Dead'
         assert section['units'] == 86
         assert section['meetings'][0]['days'] is None
         assert section['meetings'][0]['time'] is None
         assert section['meetings'][0]['location'] is None
         assert section['meetings'][0]['instructors'] == ['Hal Colossus']