-
Notifications
You must be signed in to change notification settings - Fork 184
Description
Background
There are two types of blocks which randomize library content:
- LegacyLibraryContentBlock, a.k.a. the "Randomized Content Module", which randomizes from a V1 library.
- ItemBankBlock, a.k.a. the "Problem Bank", which randomizes a selection from a V2 library.
- Note: Technically, the block will randomize any children you give to it. It's just that the UI specifically supports sourcing and syncing those children from a V2 library. But, in OLX, it's possible to specify arbitrary children.
LegacyLibraryContentBlock (V1)
The interface for the LegacyLibraryContentBlocks looks like this:
and the OLX looks like this:
<library_content source_library="library-v1:MyOrg+MyLib" source_library_version="abcd1234">
<problem>...</problem>
<problem>...</problem>
</library_content>Note that the library, library version, and updates are all centrally managed by the library_content block.
ItemBankBlock (V2)
On the other hand, the interface for the ItemBankBlock looks like this:
and the OLX looks like this:
<itembank>
<problem upstream="lb:MyOrg:MyLib1:problem:1" upstream_version="9">...</problem>
<problem upstream="lb:MyOrg:MyLib2:problem:1" upstream_version="16">...</problem>
</itembank>Notice that the ItemBankBlock manages references, versions, and updates per-child rather than as a whole container. In other words, each item can come from a different library, can have a different version, and can (must) be updated individually. This is intentionally different from the LegacyLibraryContentBlock.
The Challenge
The LegacyLibraryContentBlock OLX must work forever. But, V1 libraries are all being migrated to V2 libraries and then deleted. So, we need the LegacyLibraryContentBlock to work with the migrated V2 library content.
Specification
Support the following scenarios, where we have a LegacyLibraryContentBlock with source_library_id L:
Interface
- L points at a legacy library, which has been migrated to a new V2 library.
- Block Behavior: Preview and settings editor should look just like a modern ItemBank block.
- Child Behavior: If updates are available (see below), they are shown per-child on the View page, using the migrated child blocks as the update source.
- L points at a legacy library, which has not been migrated.
- Block and Child Behavior: Use existing LegacyLibraryContentBlock interface behavior.
- L is None, malformed, or doesn't point to an existing or migrated legacy library:
- Block Behavior: Display a validation error. Syncing is not allowed. (existing behavior)
- Child Behavior: Children are displayed if they exist, but no option to sync is offered.
Computing availability of updates on a LegacyLibraryContentBlock
To check whether a legacy library has been migrated, you will look at a ModulestoreSource model instance for the legacy library, and see if it has a "forwarded" ModulestoreMigration (or, more likely, you'll call a Python API which uses these models). The ModulestoreMigration model (or its API) should have information on what the version of the source legacy library was when it was migrated. Furthermore, each ModulestoreBlockMigration should have information on the initial version of each post-migration target block. With that information, any given LegacyLibraryContentBlock child should have sync available if all of the following are true:
- The parent LegacyLibraryContentBlock points to a source legacy library has been migrated to a V2 library, and
- The user has read permission on the target target library, and
- Any of the following are true:
- The parent LegacyLibraryContentBlock's version does not equal the migrated source library version (indicating that the legacy library received updates before its migration happened), or
- The child migration target version is less than the latest target library for the block, or
- The child has an
upstream_versionfield which is less than the latest target library version for the block.
TODO: I wrote the above in a rush, need to clarify it.
OLX
TBC
Metadata
Metadata
Assignees
Labels
Type
Projects
Status