diff --git a/lms/services/user.py b/lms/services/user.py index ec411bb184..5abd118bbd 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(