hypothesis / lms

LTI app for integrating with learning management systems
BSD 2-Clause "Simplified" License
46 stars 14 forks source link

Store start/end points for assignment in LMS assignment URLs #5809

Closed robertknight closed 11 months ago

robertknight commented 1 year ago

VitalSource assignments currently just store a start point in their URL. To support https://github.com/hypothesis/lms/issues/5808 this needs to be expanded to allow for configuring a page range. I expect that this concept of specifying start and end points in the content for an assignment will be expanded to other sources in future, so we should design the feature with that in mind.

robertknight commented 11 months ago

Slack discussion: https://hypothes-is.slack.com/archives/C1MA4E9B9/p1700226427293399

robertknight commented 11 months ago

Some notes from https://hypothes-is.slack.com/archives/C1MA4E9B9/p1700226427293399:

Current VS assignments have URLs that look like this:

vitalsource://books/bookID/{book_id}/cfi/{cfi}

We'll extend this format with:

  1. An alternative way of specifying the start location cfi/{cfi} => page/{page_num}
  2. Query params to specify the ranges for the assignment

The current assumption is that VS assignments will always use a contiguous page range, so we could specify just an endpoint with end_page or end_cfi eg:

vitalsource://books/bookID/{book_id}/cfi/{cfi}?end_cfi={cfi}
vitalsource://books/bookID/{book_id}/page/{page}?end_page={end_page}

To keep the knowledge of how these URLs are constructed in one place in the code, we'll have the frontend call a new API to generate the document URL for a given configuration. These URLs are currently returned as part of the /api/vitalsource/toc API, but that won't work when they need to specify a page number as a start point or an end point.

robertknight commented 11 months ago

Implemented in https://github.com/hypothesis/lms/pull/5838.