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

Store canvas terms info on the database #6969

Merged
merged 1 commit into from
Jan 29, 2025
Merged

Store canvas terms info on the database #6969

merged 1 commit into from
Jan 29, 2025

Conversation

marcospri
Copy link
Member

@marcospri marcospri commented Jan 27, 2025

We'll start storing this data based on launches that contain the lastest Canvas configuration, which includes variables about terms.

This will allow us to build a backlog of courses with start and end dates.

We recently did a similar job to store course dates, which in Canvas means courses that don't belong to a term. In combination this commit this should give us coverage of all LTI1.3 courses for schools that have the most recent configuration.

See: #6941


Testing

  • Apply the migration
tox -e dev --run-command 'alembic upgrade head' 
  
dev run-test-pre: PYTHONHASHSEED='4055832553'
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 9be518500f7d -> a8fd48c30957, Create the lms_term table.
  • Launch an assignment that won't send term information:

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

  • Everything looks good, nothing gets created on the DB.

  • Launch an assignment that does send term information

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

  • Check the DB for the new data:
select lms_course.name, lms_term.name, lms_term.starts_at, lms_term.ends_at from lms_term join lms_course on lms_term.id = lms_term_id;
      name       |     name     | starts_at |       ends_at       
-----------------+--------------+-----------+---------------------
 LTI 1.3 Testing | Default Term |           | 2027-04-30 06:00:00
(1 row)

@marcospri marcospri changed the base branch from main to store-term-info-model January 27, 2025 15:57
This was referenced Jan 28, 2025
@marcospri marcospri changed the title Store term info Store canvas terms info on the database Jan 28, 2025
@marcospri marcospri force-pushed the store-term-info-model branch from e0d995d to 5da01a0 Compare January 28, 2025 14:23
@@ -26,6 +29,13 @@ def __init__(self, v11: dict, v13: dict | None = None):
def v11(self):
return self

def get_datetime(self, key: str) -> datetime | None:
Copy link
Member Author

Choose a reason for hiding this comment

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

We were doing this same thing for course dates.

Generalize it a bit and move it to LTIParams.

@@ -431,22 +441,6 @@ def _get_copied_from_course(self, lti_params) -> Course | None:

return None

def _get_course_dates(
Copy link
Member Author

Choose a reason for hiding this comment

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

Moved to LTIParams.

@marcospri marcospri requested a review from mtomilov January 28, 2025 14:34
@marcospri marcospri marked this pull request as ready for review January 28, 2025 14:35
Copy link

@mtomilov mtomilov left a comment

Choose a reason for hiding this comment

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

Looks good

@marcospri marcospri force-pushed the store-term-info-model branch from 5da01a0 to 88d64e4 Compare January 29, 2025 13:16
@marcospri marcospri force-pushed the store-term-info-model branch from 88d64e4 to 0e0768d Compare January 29, 2025 14:26
Base automatically changed from store-term-info-model to main January 29, 2025 14:30
While we'll only get this information from some Canvas installs
the new table and service code are LMS agnostic.

We'll store the Canvas data for a while before exploring how to integrate other LMSes
@marcospri marcospri merged commit 902d583 into main Jan 29, 2025
9 checks passed
@marcospri marcospri deleted the store-term-info branch January 29, 2025 14:54
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