diff options
Diffstat (limited to 'utils.py')
-rw-r--r-- | utils.py | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -8,3 +8,13 @@ def get_week(year, week): end = start + datetime.timedelta(weeks=1) return start, end + +def group_courses(courses): + grouped_courses = [] + for i, course in enumerate(courses): + if i == 0 or courses[i - 1].begin.day != course.begin.day: + grouped_courses.append([course]) + else: + grouped_courses[-1].append(course) + + return grouped_courses |