Skip to content

Commit

Permalink
Store custom_canvas_user_id as LMSUser.lms_api_user_id
Browse files Browse the repository at this point in the history
  • Loading branch information
marcospri committed Nov 29, 2024
1 parent 86c631b commit f1c2f70
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lms/services/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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(
Expand Down

0 comments on commit f1c2f70

Please sign in to comment.