Skip to content

Commit

Permalink
Merge pull request #113 from Harvard-University-iCommons/patricktonne…
Browse files Browse the repository at this point in the history
…/populate-section-column

Populate section column after creating section course_instance
  • Loading branch information
PatrickMTonne authored Feb 22, 2024
2 parents 2081757 + 66cbd2d commit 9b9dca8
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion manage_sections/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import functools
import logging
import re
import uuid

from canvas_api.helpers import courses as canvas_api_helper_courses
from canvas_api.helpers import enrollments as canvas_api_helper_enrollments
Expand Down Expand Up @@ -220,13 +221,24 @@ def create_db_section(course_instance: CourseInstance, section_name: str):
sync_to_canvas = 1,
title = section_name.strip(),
short_title = section_name.strip(),
section = str(uuid.uuid4())
)
db_course_section.save()
except Exception as e:
logger.exception(
f'Unexpected error while creating section for '
f'course_instance_id:{course_instance.course_instance_id}',
f'parent_course_instance_id: {course_instance.course_instance_id}',
extra={'error': e},
)
raise

logger.info(
f'Successfully created section for '
f'parent_course_instance_id: {course_instance.course_instance_id}',
extra={
'course_instance_id': db_course_section.course_instance_id,
'title': db_course_section.title,
}
)

return db_course_section

0 comments on commit 9b9dca8

Please sign in to comment.