Skip to content

Commit

Permalink
MUWM-5362
Browse files Browse the repository at this point in the history
  • Loading branch information
fanglinfang committed Sep 20, 2024
1 parent 1101552 commit 750a8ea
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions myuw/dao/canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,19 @@ def set_section_canvas_course_urls(canvas_active_enrollments, schedule,
for enrollment in canvas_active_enrollments:
(section_label, inst_regid) = sws_section_label(
enrollment.sws_section_id())
(course_label, inst_regid) = sws_section_label(
enrollment.sis_course_id)
if (course_label and course_label in section_labels or
section_label and section_label in section_labels):
sis_course_id = enrollment.sis_course_id
logger.info({
'course_label': course_label,
'section_label': section_label,
'canvas_course_url': enrollment.course_url})
if sis_course_id and sis_course_id not in canvas_links:
canvas_links[sis_course_id] = enrollment.course_url
if section_label and section_label in section_labels:
sis_course_id = section_label
else:
(course_label, inst_regid) = sws_section_label(
enrollment.sis_course_id)
if course_label and course_label in section_labels:
sis_course_id = course_label

logger.info({
'sis_course_id': sis_course_id,
'canvas_course_url': enrollment.course_url})
if sis_course_id and sis_course_id not in canvas_links:
canvas_links[sis_course_id] = enrollment.course_url

for section in schedule.sections:
try:
Expand Down Expand Up @@ -104,14 +106,11 @@ def get_canvas_course_url(sws_section, person):
def sws_section_label(sis_id):
canvas_section = CanvasSection(sis_section_id=sis_id)
sws_label = canvas_section.sws_section_id()
if sws_label is None:
canvas_course = CanvasCourse(sis_course_id=sis_id)
sws_label = canvas_course.sws_course_id()
logger.info({"sws_section_id": sws_label})
return (sws_label, canvas_course.sws_instructor_regid())
else:
logger.info({"sws_section_id": sws_label})
if sws_label is not None:
return (sws_label, canvas_section.sws_instructor_regid())
canvas_course = CanvasCourse(sis_course_id=sis_id)
sws_label = canvas_course.sws_course_id()
return (sws_label, canvas_course.sws_instructor_regid())


def get_viewable_course_sections(canvas_course_id, canvas_user_id):
Expand Down

0 comments on commit 750a8ea

Please sign in to comment.