Skip to content

Commit

Permalink
Merge pull request #833 from noahpresler/bugfix/convert_tt_to_dict
Browse files Browse the repository at this point in the history
Temporarily ignore course filled bug
  • Loading branch information
noahpresler committed Apr 26, 2017
2 parents 63045b3 + 5300bdd commit 6447179
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions student/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,11 @@ def convert_tt_to_dict(timetable, include_last_updated=True):
courses[-1]['slots'] = []
courses[-1]['enrolled_sections'] = []
courses[-1]['textbooks'] = {}
courses[-1]['is_waitlist_only'] = False

index = course_ids.index(c.id)
courses[index]['slots'].extend([merge_dicts(get_section_dict(section_obj), model_to_dict(co)) for co in section_obj.offering_set.all()])
courses[index]['slots'].extend([merge_dicts(get_section_dict(section_obj), model_to_dict(co))
for co in section_obj.offering_set.all()])
courses[index]['textbooks'][section_obj.meeting_section] = section_obj.get_textbooks()

courses[index]['enrolled_sections'].append(section_obj.meeting_section)
Expand All @@ -145,8 +147,10 @@ def convert_tt_to_dict(timetable, include_last_updated=True):
course_section_list = sorted(course_obj.section_set.filter(semester=timetable.semester),
key=lambda s: s.section_type)
section_type_to_sections = itertools.groupby(course_section_list, lambda s: s.section_type)
index = course_ids.index(course_obj.id)
courses[index]['is_waitlist_only'] = any(sections_are_filled(sections) for _, sections in section_type_to_sections)
if course_obj.id in course_ids:
index = course_ids.index(course_obj.id)
courses[index]['is_waitlist_only'] = any(sections_are_filled(sections)
for _, sections in section_type_to_sections)

tt_dict['courses'] = courses
tt_dict['avg_rating'] = get_avg_rating(course_ids)
Expand Down

0 comments on commit 6447179

Please sign in to comment.