From 2e508fc18aaabd474735983e17d747fa08771318 Mon Sep 17 00:00:00 2001 From: Marcos Prieto Date: Thu, 28 Nov 2024 14:41:53 +0100 Subject: [PATCH] Store custom_canvas_user_id as LMSUser.lms_api_user_id --- lms/services/user.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lms/services/user.py b/lms/services/user.py index 392ca5c4d7..2d265b0bec 100644 --- a/lms/services/user.py +++ b/lms/services/user.py @@ -75,6 +75,9 @@ def upsert_user(self, lti_user: LTIUser) -> User: def upsert_lms_user(self, user: User, lti_params: LTIParams) -> LMSUser: """Upsert LMSUser based on a User object.""" self._db.flush() # Make sure User has hit the DB on the current transaction + + # API ID, only Canvas for now + api_id = lti_params.get("custom_canvas_user_id") lms_user = bulk_upsert( self._db, LMSUser, @@ -101,6 +104,7 @@ def upsert_lms_user(self, user: User, lti_params: LTIParams) -> LMSUser: text('"lms_user"."lti_v13_user_id"'), ), ), + "lms_api_user_id", ], ).one() bulk_upsert(