learningequality / learningequality/studio
Migrate AssessmentItem data to proper JSON fields
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 191
- Forks
- 307
- Avg merge
- 5d 6h
- Merged PRs (30d)
- 10
Description
Builds upon https://github.com/learningequality/studio/issues/897 and https://github.com/learningequality/studio/pull/3901
Desired behavior
Proper resolution of this will involve several steps:
- Converting
answers, andhintsfields into ajsonfieldJSONField(not a proper postgres JSONField to avoid a complex migration for now). - To ensure proper interaction with ValuesViewsets, we should copy the extension of the
jsonfieldJSONFieldthat is done in Kolibri here: https://github.com/learningequality/kolibri/blob/release-v0.14.x/kolibri/core/fields.py#L102 - This will then require updating of the frontend to expect JSON, as opposed to a string for these fields https://github.com/learningequality/studio/issues/1855
By itself, these steps would at least be sufficient to ensure that the incoming data is validated as JSON on save.
However, as the data will now be stored in IndexedDB in the frontend as JSON, any edits to them will be recorded by keypath, rather than the entire text field changing. This has the advantage of giving more granular edits, but means we need to update our serializers to properly handle this.
- Some original work will be required to be done, probably using the DotPathValueMixin, and in a similar way to the TagField used in the ContentNode serializer.
- The way that the data is serialized to the frontend should also be updated in order to be sent as a map (see e.g. tags for contentnodes), however, as there is additional data rather than just a tag name, a more complex method would be required.
Current behavior
Data is stored as text but is validated as JSON in https://github.com/learningequality/studio/pull/3901
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading issue 897 and pull request 3901, then inspect the AssessmentItem fields and the referenced Kolibri fields.py extension. Review DotPathValueMixin and the TagField and content-node serializer examples in common.py and contentnode.py. Done means answers and hints are stored and validated as JSON, with frontend serialization and keypath edits handled correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, database, frontend
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100