From 63e0d37896e215ca53fe487671da938fc6732a87 Mon Sep 17 00:00:00 2001 From: Fang Lin Date: Fri, 20 Sep 2024 12:11:51 -0700 Subject: [PATCH 01/14] deploy to vue.my --- .github/workflows/cicd.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 1ed3128df..8a27893c4 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -43,9 +43,9 @@ env: # defined in the "deploy" job on: push: - branches: [main, master, qa, develop, vue/dev] + branches: [main, master, qa, develop, fix/MUWM-5362] pull_request: - branches: [main, master, qa, develop, vue/dev] + branches: [main, master, qa, develop, fix/MUWM-5362] types: [opened, reopened, synchronize] release: branches: [main, master] @@ -304,7 +304,7 @@ jobs: app_instance: dev - name: Deploy Vue Branch - if: needs.context.outputs.git_repo_branch == 'vue/dev' + if: needs.context.outputs.git_repo_branch == 'fix/MUWM-5362' uses: uw-it-aca/actions/cicd-deploy@main with: release_name: ${{ env.RELEASE_NAME }} @@ -322,7 +322,7 @@ jobs: if: github.event_name == 'push' && (endsWith(github.ref, '/main') || endsWith(github.ref, '/master') || endsWith(github.ref, '/qa') || endsWith(github.ref, '/develop') || - endsWith(github.ref, '/vue/dev')) + endsWith(github.ref, '/fix/MUWM-5362')) needs: [context, build, deploy] From c45ce54894770ce54666cb72fb32d70a48caead9 Mon Sep 17 00:00:00 2001 From: Fang Lin Date: Fri, 20 Sep 2024 12:14:21 -0700 Subject: [PATCH 02/14] log canvas_act_enrollments --- myuw/dao/canvas.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/myuw/dao/canvas.py b/myuw/dao/canvas.py index 9ffc59c9f..551dbe16a 100644 --- a/myuw/dao/canvas.py +++ b/myuw/dao/canvas.py @@ -15,6 +15,7 @@ from myuw.dao.term import get_comparison_datetime logger = logging.getLogger(__name__) +canvas_enrollments = Enrollments() def canvas_prefetch(): @@ -26,9 +27,11 @@ def _method(request): def get_canvas_active_enrollments(request): if not hasattr(request, "canvas_act_enrollments"): request.canvas_act_enrollments = ( - Enrollments().get_enrollments_for_regid( + canvas_enrollments.get_enrollments_for_regid( get_regid_of_current_user(request), {'type': ['StudentEnrollment'], 'state': ['active']})) + logger.info({'canvas_act_enrollments': + request.canvas_act_enrollments[0].json_data()}) return request.canvas_act_enrollments @@ -108,7 +111,7 @@ def get_viewable_course_sections(canvas_course_id, canvas_user_id): limit_privileges_to_course_section = False limit_sections = {} - enrollments = Enrollments().get_enrollments_for_course( + enrollments = canvas_enrollments.get_enrollments_for_course( canvas_course_id, params={'user_id': canvas_user_id}) for enrollment in enrollments: From d779b7b6ad2f0cc2cabb99e94f0c67964caffc29 Mon Sep 17 00:00:00 2001 From: Fang Lin Date: Fri, 20 Sep 2024 12:32:00 -0700 Subject: [PATCH 03/14] log canvas_url --- myuw/dao/canvas.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/myuw/dao/canvas.py b/myuw/dao/canvas.py index 551dbe16a..023bae9a2 100644 --- a/myuw/dao/canvas.py +++ b/myuw/dao/canvas.py @@ -50,6 +50,9 @@ def set_section_canvas_course_urls(canvas_active_enrollments, schedule, (sws_label, inst_regid) = sws_section_label(enrollment.sis_course_id) if sws_label is not None and sws_label in section_labels: sis_course_id = enrollment.sis_course_id + logger.info({ + 'sis_course_id': sis_course_id, + 'canvas_course_url': enrollment.course_url}) if sis_course_id not in canvas_links: canvas_links[sis_course_id] = enrollment.course_url From 317b9f24ca5b6d65100ca95dfbd2c2461c563cb1 Mon Sep 17 00:00:00 2001 From: Fang Lin Date: Fri, 20 Sep 2024 12:59:44 -0700 Subject: [PATCH 04/14] debug --- myuw/dao/canvas.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/myuw/dao/canvas.py b/myuw/dao/canvas.py index 023bae9a2..e8734b5a3 100644 --- a/myuw/dao/canvas.py +++ b/myuw/dao/canvas.py @@ -44,15 +44,18 @@ def set_section_canvas_course_urls(canvas_active_enrollments, schedule, section_labels = set() for section in schedule.sections: section_labels.add(section.section_label()) + logger.info({ + 'section_label': section.section_label()}) canvas_links = {} # sis_course_id: canvas course_url for enrollment in canvas_active_enrollments: (sws_label, inst_regid) = sws_section_label(enrollment.sis_course_id) + logger.info({ + 'sws_label': sws_label, + 'sis_course_id': sis_course_id, + 'canvas_course_url': enrollment.course_url}) if sws_label is not None and sws_label in section_labels: sis_course_id = enrollment.sis_course_id - logger.info({ - 'sis_course_id': sis_course_id, - 'canvas_course_url': enrollment.course_url}) if sis_course_id not in canvas_links: canvas_links[sis_course_id] = enrollment.course_url From 3936aeb5f2a5b352e0a487d930fe9ef937d4f7df Mon Sep 17 00:00:00 2001 From: Fang Lin Date: Fri, 20 Sep 2024 13:16:41 -0700 Subject: [PATCH 05/14] debug --- myuw/dao/canvas.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/myuw/dao/canvas.py b/myuw/dao/canvas.py index e8734b5a3..c5e4101f5 100644 --- a/myuw/dao/canvas.py +++ b/myuw/dao/canvas.py @@ -52,7 +52,7 @@ def set_section_canvas_course_urls(canvas_active_enrollments, schedule, (sws_label, inst_regid) = sws_section_label(enrollment.sis_course_id) logger.info({ 'sws_label': sws_label, - 'sis_course_id': sis_course_id, + 'sis_course_id': enrollment.sis_course_id, 'canvas_course_url': enrollment.course_url}) if sws_label is not None and sws_label in section_labels: sis_course_id = enrollment.sis_course_id From 93aec72cfe637d9c56b584d697b99b70ab50d98c Mon Sep 17 00:00:00 2001 From: Fang Lin Date: Fri, 20 Sep 2024 14:26:56 -0700 Subject: [PATCH 06/14] Resolve MUWM-5362 --- myuw/dao/canvas.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/myuw/dao/canvas.py b/myuw/dao/canvas.py index c5e4101f5..391af6616 100644 --- a/myuw/dao/canvas.py +++ b/myuw/dao/canvas.py @@ -49,14 +49,18 @@ def set_section_canvas_course_urls(canvas_active_enrollments, schedule, canvas_links = {} # sis_course_id: canvas course_url for enrollment in canvas_active_enrollments: - (sws_label, inst_regid) = sws_section_label(enrollment.sis_course_id) - logger.info({ - 'sws_label': sws_label, - 'sis_course_id': enrollment.sis_course_id, - 'canvas_course_url': enrollment.course_url}) - if sws_label is not None and sws_label in section_labels: + (course_label, inst_regid) = sws_section_label( + enrollment.sis_course_id) + (section_label, inst_regid) = sws_section_label( + enrollment.sws_section_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 - if sis_course_id not in canvas_links: + 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 for section in schedule.sections: From 11015528e2d8876abf9ac55131a2060db128890f Mon Sep 17 00:00:00 2001 From: Fang Lin Date: Fri, 20 Sep 2024 15:14:04 -0700 Subject: [PATCH 07/14] MUWM-5362 --- myuw/dao/canvas.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/myuw/dao/canvas.py b/myuw/dao/canvas.py index 391af6616..31702ddb3 100644 --- a/myuw/dao/canvas.py +++ b/myuw/dao/canvas.py @@ -49,10 +49,10 @@ def set_section_canvas_course_urls(canvas_active_enrollments, schedule, canvas_links = {} # sis_course_id: canvas course_url 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) - (section_label, inst_regid) = sws_section_label( - enrollment.sws_section_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 @@ -107,8 +107,10 @@ def sws_section_label(sis_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}) return (sws_label, canvas_section.sws_instructor_regid()) From 750a8ea816283245708ab24b34b4075a66da9530 Mon Sep 17 00:00:00 2001 From: Fang Lin Date: Fri, 20 Sep 2024 15:27:20 -0700 Subject: [PATCH 08/14] MUWM-5362 --- myuw/dao/canvas.py | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/myuw/dao/canvas.py b/myuw/dao/canvas.py index 31702ddb3..0994fafc0 100644 --- a/myuw/dao/canvas.py +++ b/myuw/dao/canvas.py @@ -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: @@ -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): From 7b73c993772dbe844e8d7f80816f34c64380916c Mon Sep 17 00:00:00 2001 From: Fang Lin Date: Fri, 20 Sep 2024 17:25:39 -0700 Subject: [PATCH 09/14] Resolve MUWM-5362 --- myuw/dao/canvas.py | 41 ++++++++++++++++++++---------------- myuw/test/dao/test_canvas.py | 9 ++++---- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/myuw/dao/canvas.py b/myuw/dao/canvas.py index 0994fafc0..9dd41da43 100644 --- a/myuw/dao/canvas.py +++ b/myuw/dao/canvas.py @@ -9,7 +9,8 @@ from uw_canvas.sections import Sections from uw_canvas.courses import Courses from uw_canvas.models import CanvasCourse, CanvasSection -from uw_sws.exceptions import InvalidCanvasIndependentStudyCourse +from uw_sws.exceptions import ( + InvalidCanvasIndependentStudyCourse, InvalidCanvasSection) from myuw.dao import log_err from myuw.dao.pws import get_regid_of_current_user from myuw.dao.term import get_comparison_datetime @@ -41,34 +42,38 @@ def set_section_canvas_course_urls(canvas_active_enrollments, schedule, Set canvas_course_url in schedule.sections """ now = get_comparison_datetime(request) - section_labels = set() + canvas_sis_ids = {} # MUWM-5362 for section in schedule.sections: - section_labels.add(section.section_label()) - logger.info({ - 'section_label': section.section_label()}) + section_label = section.section_label() + try: + canvas_sis_ids[section.canvas_section_sis_id()] = section_label + logger.info({ + 'canvas_section_sis_id': section.canvas_section_sis_id()}) + except Exception as ex: + log_err(logger, f"{section_label} {ex}", traceback, request) + try: + canvas_sis_ids[section.canvas_course_sis_id()] = section_label + except Exception as ex: + log_err(logger, f"{section_label} {ex}", traceback, request) - canvas_links = {} # sis_course_id: canvas course_url + canvas_links = {} # section_label: canvas course_url for enrollment in canvas_active_enrollments: - (section_label, inst_regid) = sws_section_label( - enrollment.sws_section_id()) - if section_label and section_label in section_labels: - sis_course_id = section_label + if enrollment.sis_section_id in canvas_sis_ids: + section_label = canvas_sis_ids[enrollment.sis_section_id] 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 + if enrollment.sis_course_id in canvas_sis_ids: + section_label = canvas_sis_ids[enrollment.sis_course_id] logger.info({ - 'sis_course_id': sis_course_id, + '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 not in canvas_links: + canvas_links[section_label] = enrollment.course_url for section in schedule.sections: try: section.canvas_course_url = canvas_links.get( - section.canvas_course_sis_id()) + section.section_label()) except InvalidCanvasIndependentStudyCourse as ex: # REQ3132940 known SWS issue: # prior quarter's registration data has diff --git a/myuw/test/dao/test_canvas.py b/myuw/test/dao/test_canvas.py index d1baf8936..e0035d5c2 100644 --- a/myuw/test/dao/test_canvas.py +++ b/myuw/test/dao/test_canvas.py @@ -29,9 +29,9 @@ def test_get_canvas_active_enrollments(self): set_section_canvas_course_urls(canvas_active_enrollments, schedule, req) - section1 = schedule.sections[0] + section1 = schedule.sections[2] self.assertEqual(section1.section_label(), - "2013,spring,PHYS,121/A") + "2013,spring,PHYS,121/AQ") self.assertEqual(section1.canvas_course_url, 'https://test.edu/courses/249652') @@ -67,8 +67,9 @@ def test_get_canvas_active_enrollments(self): self.assertIsNotNone(req.canvas_act_enrollments) set_section_canvas_course_urls(canvas_active_enrollments, schedule, req) - with self.assertRaises(AttributeError): - a = schedule.sections[0].canvas_course_url + self.assertEqual( + schedule.sections[0].canvas_course_url, + 'https://test.edu/courses/249652') def test_get_canvas_course_url(self): person = Person() From 12541ca66c63efd5c579cdbfebdbe4d88462572e Mon Sep 17 00:00:00 2001 From: Fang Lin Date: Sat, 21 Sep 2024 10:30:25 -0700 Subject: [PATCH 10/14] Resolve fix/MUWM-5362 --- myuw/dao/canvas.py | 66 ++++++++++++++++++------------------ myuw/test/dao/test_canvas.py | 12 +++++-- requirements.txt | 1 + setup.py | 2 +- 4 files changed, 44 insertions(+), 37 deletions(-) diff --git a/myuw/dao/canvas.py b/myuw/dao/canvas.py index 9dd41da43..7f9a4a962 100644 --- a/myuw/dao/canvas.py +++ b/myuw/dao/canvas.py @@ -41,50 +41,50 @@ def set_section_canvas_course_urls(canvas_active_enrollments, schedule, """ Set canvas_course_url in schedule.sections """ - now = get_comparison_datetime(request) - canvas_sis_ids = {} # MUWM-5362 + canvas_sis_ids = {} + # MUWM-5362 {canvas_section_sis_id: primary_section_label} for section in schedule.sections: section_label = section.section_label() + try: - canvas_sis_ids[section.canvas_section_sis_id()] = section_label - logger.info({ - 'canvas_section_sis_id': section.canvas_section_sis_id()}) - except Exception as ex: - log_err(logger, f"{section_label} {ex}", traceback, request) + cid = section.canvas_course_sis_id() + if cid not in canvas_sis_ids: + canvas_sis_ids[cid] = section.primary_section_label() + except InvalidCanvasIndependentStudyCourse as ex: + # REQ3132940 known SWS issue: + # prior quarter's registration data has + # no independent study instructor. + # If independent_study_instructor being None occurs + # in current or future quarter, likely is a data error. + log_err( + logger, f"canvas_course_sis_id of {section_label} {ex}", + traceback, request) + continue try: - canvas_sis_ids[section.canvas_course_sis_id()] = section_label + cid = section.canvas_section_sis_id() + canvas_sis_ids[cid] = section.primary_section_label() except Exception as ex: - log_err(logger, f"{section_label} {ex}", traceback, request) + log_err( + logger, f"canvas_section_sis_id of {section_label} {ex}", + traceback, request) + + logger.info({'canvas_sis_ids': canvas_sis_ids}) - canvas_links = {} # section_label: canvas course_url + canvas_links = {} # primary_section_label: canvas course_url for enrollment in canvas_active_enrollments: + psection_label = None + # MUWM-5362 check both course and section if enrollment.sis_section_id in canvas_sis_ids: - section_label = canvas_sis_ids[enrollment.sis_section_id] + psection_label = canvas_sis_ids[enrollment.sis_section_id] else: if enrollment.sis_course_id in canvas_sis_ids: - section_label = canvas_sis_ids[enrollment.sis_course_id] - - logger.info({ - 'section_label': section_label, - 'canvas_course_url': enrollment.course_url}) - if section_label and section_label not in canvas_links: - canvas_links[section_label] = enrollment.course_url - + psection_label = canvas_sis_ids[enrollment.sis_course_id] + if psection_label and psection_label not in canvas_links: + canvas_links[psection_label] = enrollment.course_url + logger.info({'canvas_links': canvas_links}) for section in schedule.sections: - try: - section.canvas_course_url = canvas_links.get( - section.section_label()) - except InvalidCanvasIndependentStudyCourse as ex: - # REQ3132940 known SWS issue: - # prior quarter's registration data has - # no independent study instructor. - # If independent_study_instructor being None occurs - # in current or future quarter, likely is a data error. - if not section.term.is_past(now): - log_err(logger, - "{} {}".format(section.section_label(), ex), - traceback, request) - pass + section.canvas_course_url = canvas_links.get( + section.primary_section_label()) def get_canvas_course_from_section(sws_section): diff --git a/myuw/test/dao/test_canvas.py b/myuw/test/dao/test_canvas.py index e0035d5c2..d673a40a7 100644 --- a/myuw/test/dao/test_canvas.py +++ b/myuw/test/dao/test_canvas.py @@ -2,6 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 from django.test import TestCase +from restclients_core.exceptions import DataFailureException from myuw.dao.canvas import ( get_canvas_active_enrollments, set_section_canvas_course_urls, get_canvas_course_from_section, @@ -60,6 +61,12 @@ def test_get_canvas_active_enrollments(self): self.assertEqual(section.section_label(), "2013,spring,TRAIN,101/A") self.assertIsNotNone(section.canvas_course_url) + req = get_request_with_user("jbothell") + schedule = get_schedule_by_term(req, get_current_quarter(req)) + self.assertRaises( + DataFailureException, get_canvas_active_enrollments, req) + + def test_InvalidCanvasIndependentStudyCourse_case(self): req = get_request_with_user("jeos", get_request_with_date("2013-10-01")) schedule = get_schedule_by_term(req, get_current_quarter(req)) @@ -67,9 +74,8 @@ def test_get_canvas_active_enrollments(self): self.assertIsNotNone(req.canvas_act_enrollments) set_section_canvas_course_urls(canvas_active_enrollments, schedule, req) - self.assertEqual( - schedule.sections[0].canvas_course_url, - 'https://test.edu/courses/249652') + # InvalidCanvasIndependentStudyCourse + self.assertIsNone(schedule.sections[0].canvas_course_url) def test_get_canvas_course_url(self): person = Person() diff --git a/requirements.txt b/requirements.txt index d6e1198b1..f75038e70 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ -e . +-e git+https://github.com/uw-it-aca/uw-restclients-sws@develop#egg=UW-RestClients-SWS diff --git a/setup.py b/setup.py index cffbe0cce..f42611fc3 100644 --- a/setup.py +++ b/setup.py @@ -47,7 +47,7 @@ 'UW-RestClients-Mailman~=2.0', 'UW-RestClients-MyPlan~=1.1', 'UW-RestClients-PWS~=2.1', - 'UW-RestClients-SWS~=2.4', + # 'UW-RestClients-SWS~=2.4', 'UW-RestClients-Sdbmyuw~=1.0', 'UW-RestClients-Space~=1.2', 'UW-RestClients-Trumba~=1.4', From 575f0d55dcb0f348bb82697e0fdabd723788d72c Mon Sep 17 00:00:00 2001 From: Fang Lin Date: Sat, 21 Sep 2024 10:45:33 -0700 Subject: [PATCH 11/14] Support search student Canvas enrollment --- myuw/dao/canvas.py | 8 ++++---- .../customform/canvas/active_enrollments.html | 11 +++++++++++ myuw/templates/supporttools/custom_sidebar_links.html | 7 +++++++ myuw/views/rest_search.py | 5 +++++ 4 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 myuw/templates/restclients/customform/canvas/active_enrollments.html diff --git a/myuw/dao/canvas.py b/myuw/dao/canvas.py index 7f9a4a962..65c70b510 100644 --- a/myuw/dao/canvas.py +++ b/myuw/dao/canvas.py @@ -31,7 +31,7 @@ def get_canvas_active_enrollments(request): canvas_enrollments.get_enrollments_for_regid( get_regid_of_current_user(request), {'type': ['StudentEnrollment'], 'state': ['active']})) - logger.info({'canvas_act_enrollments': + logger.debug({'canvas_act_enrollments': request.canvas_act_enrollments[0].json_data()}) return request.canvas_act_enrollments @@ -67,8 +67,7 @@ def set_section_canvas_course_urls(canvas_active_enrollments, schedule, log_err( logger, f"canvas_section_sis_id of {section_label} {ex}", traceback, request) - - logger.info({'canvas_sis_ids': canvas_sis_ids}) + logger.debug({'canvas_sis_ids': canvas_sis_ids}) canvas_links = {} # primary_section_label: canvas course_url for enrollment in canvas_active_enrollments: @@ -81,7 +80,8 @@ def set_section_canvas_course_urls(canvas_active_enrollments, schedule, psection_label = canvas_sis_ids[enrollment.sis_course_id] if psection_label and psection_label not in canvas_links: canvas_links[psection_label] = enrollment.course_url - logger.info({'canvas_links': canvas_links}) + logger.debug({'canvas_links': canvas_links}) + for section in schedule.sections: section.canvas_course_url = canvas_links.get( section.primary_section_label()) diff --git a/myuw/templates/restclients/customform/canvas/active_enrollments.html b/myuw/templates/restclients/customform/canvas/active_enrollments.html new file mode 100644 index 000000000..36d3b8fec --- /dev/null +++ b/myuw/templates/restclients/customform/canvas/active_enrollments.html @@ -0,0 +1,11 @@ +

Canvas Student Active Enrollments

+
+ {% csrf_token %} +

+ + +

+

+ +

+
diff --git a/myuw/templates/supporttools/custom_sidebar_links.html b/myuw/templates/supporttools/custom_sidebar_links.html index 7ff298af1..a4e89a871 100644 --- a/myuw/templates/supporttools/custom_sidebar_links.html +++ b/myuw/templates/supporttools/custom_sidebar_links.html @@ -47,6 +47,13 @@

Web Services

{% endif %} + {% url 'myuw_rest_search' 'canvas' 'active_enrollments.html' as canvas_url %} + {% if canvas_url %} +
  • + Canvas Student +
  • + {% endif %} + {% url 'myuw_rest_search' 'hfs' 'accounts.html' as hfs_url %} {% if hfs_url %}
  • diff --git a/myuw/views/rest_search.py b/myuw/views/rest_search.py index c2564d7e0..63d18ad6d 100644 --- a/myuw/views/rest_search.py +++ b/myuw/views/rest_search.py @@ -33,6 +33,11 @@ def get_proxy_url(self, request, service, url): "uw/json_utf8_202007.ubs", get_input_value(request.POST, "quarter"), get_input_value(request.POST, "sln1")) + elif service == "canvas": + regid = get_regid(get_input_value(request.POST, "uwregid")) + url = ( + f"api/v1/users/sis_user_id:{regid}/enrollments?" + + f"state[]=active&type[]=StudentEnrollment") elif service == "grad": params = self.format_params(request) params['id'] = get_student_system_key(params['id']) From dabd7373308b2a87a383c3466e7fde50dd71365e Mon Sep 17 00:00:00 2001 From: Fang Lin Date: Sat, 21 Sep 2024 11:51:20 -0700 Subject: [PATCH 12/14] Up maxReplicas 150 --- docker/prod-values.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/prod-values.yml b/docker/prod-values.yml index 846e13e8c..bd48d4a92 100644 --- a/docker/prod-values.yml +++ b/docker/prod-values.yml @@ -1,7 +1,7 @@ autoscaling: enabled: true minReplicas: 4 - maxReplicas: 120 + maxReplicas: 150 targetAverageUtilization: 100 resources: limits: From e7a62ccd179ebeafdebcaa0cee168dc1c06687a7 Mon Sep 17 00:00:00 2001 From: Fang Lin Date: Sat, 21 Sep 2024 11:55:09 -0700 Subject: [PATCH 13/14] Reset vue.my --- .github/workflows/cicd.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 8a27893c4..1ed3128df 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -43,9 +43,9 @@ env: # defined in the "deploy" job on: push: - branches: [main, master, qa, develop, fix/MUWM-5362] + branches: [main, master, qa, develop, vue/dev] pull_request: - branches: [main, master, qa, develop, fix/MUWM-5362] + branches: [main, master, qa, develop, vue/dev] types: [opened, reopened, synchronize] release: branches: [main, master] @@ -304,7 +304,7 @@ jobs: app_instance: dev - name: Deploy Vue Branch - if: needs.context.outputs.git_repo_branch == 'fix/MUWM-5362' + if: needs.context.outputs.git_repo_branch == 'vue/dev' uses: uw-it-aca/actions/cicd-deploy@main with: release_name: ${{ env.RELEASE_NAME }} @@ -322,7 +322,7 @@ jobs: if: github.event_name == 'push' && (endsWith(github.ref, '/main') || endsWith(github.ref, '/master') || endsWith(github.ref, '/qa') || endsWith(github.ref, '/develop') || - endsWith(github.ref, '/fix/MUWM-5362')) + endsWith(github.ref, '/vue/dev')) needs: [context, build, deploy] From 997087f345d24364f5c9556574ce40b1b14bacd4 Mon Sep 17 00:00:00 2001 From: Fang Lin Date: Mon, 23 Sep 2024 09:52:23 -0700 Subject: [PATCH 14/14] Switch UW-RestClients-SWS back to the release on pypi --- requirements.txt | 1 - setup.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index f75038e70..d6e1198b1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1 @@ -e . --e git+https://github.com/uw-it-aca/uw-restclients-sws@develop#egg=UW-RestClients-SWS diff --git a/setup.py b/setup.py index f42611fc3..cffbe0cce 100644 --- a/setup.py +++ b/setup.py @@ -47,7 +47,7 @@ 'UW-RestClients-Mailman~=2.0', 'UW-RestClients-MyPlan~=1.1', 'UW-RestClients-PWS~=2.1', - # 'UW-RestClients-SWS~=2.4', + 'UW-RestClients-SWS~=2.4', 'UW-RestClients-Sdbmyuw~=1.0', 'UW-RestClients-Space~=1.2', 'UW-RestClients-Trumba~=1.4',