Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep the LMSUserAssignmentMembership table in sync with AssignmentMembership #6760

Merged
merged 1 commit into from
Oct 8, 2024

Conversation

marcospri
Copy link
Member

@marcospri marcospri commented Oct 7, 2024

For:


This changes allow us store the LTI1.1 grading ID which is unique per assignment and user.

We do this in a new table that follows the LMSUser, LMSCourse, LMSCourseMebmership patterns. This will allows to find membership objects without having to worry about duplicated users.

Testing

  • Apply the migration
tox -e dev --run-command 'alembic upgrade head'

dev run-test-pre: PYTHONHASHSEED='602997392'
dev run-test-pre: commands[0] | pip-sync-faster requirements/dev.txt --pip-args --disable-pip-version-check
dev run-test: commands[0] | alembic upgrade head
INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO  [alembic.runtime.migration] Will assume transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade aea9bbeee574 -> 712c4c9a4e2e, Create LMSUserAssignmentMembership.
  • Launch an LTI1.3 assignment as a teacher

https://hypothesis.instructure.com/courses/125/assignments/7777

  • Launch an LTI1.1 assignment as a teacher

https://hypothesis.instructure.com/courses/319/assignments/7296

  • Repeat the launches as a student for both assignments

  • Check the data from the DB, we'll have rows with for both thet studend and teacher, only with the lti_v11_lis_result_sourcedid on the LTI1.1 launch:

elect distinct title, lms_user.display_name, lms_user_assignment_membership.lti_v11_lis_result_sourcedid from lms_user_assignment_membership join lms_user on lms_user_id = lms_user.id join assignment on assignment.id = assignment_id order by title;                                                                                                                             title               |      display_name      |               lti_v11_lis_result_sourcedid               
----------------------------------+------------------------+----------------------------------------------------------
 localhost - LTI1.1 -Autograding  | DISPLAY NAME TEACHER   | 
 localhost - LTI1.1 -Autograding  | Hypothesis 101 Student | 416-125-7777-35-ad406308d0411f0538bf4b6c6124e44fefe4d2be
 localhost - LTI1.3 - Autograding | DISPLAY NAME TEACHER   | 
 localhost - LTI1.3 - Autograding | Hypothesis 101 Student | 
(4 rows)

@marcospri marcospri force-pushed the sync-grades-code branch 2 times, most recently from c71f539 to 35c83f4 Compare October 8, 2024 08:12
@marcospri marcospri marked this pull request as ready for review October 8, 2024 08:18
@@ -182,7 +185,11 @@ def get_assignment_for_launch(self, request, course: Course) -> Assignment | Non
)

def upsert_assignment_membership(
self, assignment: Assignment, user: User, lti_roles: list[LTIRole]
self,
lti_params: LTIParams,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New parameter to be able to pick up the new grading ID.

{
"lms_user": lms_user,
"assignment": assignment,
"lti_role": lti_role,
Copy link
Member Author

@marcospri marcospri Oct 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uppss, missing testing the grading ID test case, adding it now.

Done

@marcospri marcospri force-pushed the sync-grades-code branch 2 times, most recently from a8fcdc5 to 193840f Compare October 8, 2024 08:28
@marcospri marcospri requested a review from acelaya October 8, 2024 08:35
Copy link
Contributor

@acelaya acelaya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, and works as expected.

Base automatically changed from sync-grades-model to main October 8, 2024 13:15
@marcospri marcospri merged commit 1c521c8 into main Oct 8, 2024
9 checks passed
@marcospri marcospri deleted the sync-grades-code branch October 8, 2024 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants