adds notice for quizzes created pre-0.17.x
Summary
In version 0.17, the question_sources field structure was updated, introducing the DraftExam and Exam models. Quizzes created in versions ≥0.17.x start as DraftExam and convert to Exam . However, quizzes created prior to 0.17.x (without DraftExam ) may exist in an uneditable state if the user upgraded Kolibri without starting the quiz. This PR
add notice for legacy quiz created pre-0.17.x) should not be uneditable but should see
"This quiz was created using an older version of Kolibri and cannot be edited directly. Create a copy of it to edit the resources."
closes #12954
References
#12954
Reviewer guidance
- Import any older version on quizzes created prior to 0.17.x and try to edit if the quiz has not been started
Summary by CodeRabbit
-
New Features
- Added a warning alert banner to quiz and lesson details when viewing quizzes from older Kolibri versions, informing users that these cannot be edited directly.
-
Improvements
- Updated quiz options dropdown to only show the edit option for quizzes created with the latest version.
-
Localization
- Added a new warning message string for legacy quizzes.
Build Artifacts
| Asset type | Download link |
|---|---|
| PEX file | kolibri-0.18.0b2.dev0_git.9.g9c74a2d9.pex |
| Windows Installer (EXE) | kolibri-0.18.0b2.dev0+git.9.g9c74a2d9-windows-setup-unsigned.exe |
| Debian Package | kolibri_0.18.0b2.dev0+git.9.g9c74a2d9-0ubuntu1_all.deb |
| Mac Installer (DMG) | kolibri-0.18.0b2.dev0+git.9.g9c74a2d9.dmg |
| Android Package (APK) | kolibri-0.18.0b2.dev0+git.9.g9c74a2d9-0.1.4-debug.apk |
| Raspberry Pi Image | kolibri-pi-image-0.18.0b2.dev0+git.9.g9c74a2d9.zip |
| TAR file | kolibri-0.18.0b2.dev0+git.9.g9c74a2d9.tar.gz |
| WHL file | kolibri-0.18.0b2.dev0+git.9.g9c74a2d9-py2.py3-none-any.whl |
Thank you both @akolson and @nucleogenesis . I will wait for the final thought from @radinamatic and @marcellamaki.
I installed the DEB asset from this PR in an Ubuntu VM with a previous 0.16.2 version of Kolibri, where I had a couple of not-started quizzes. I could see that the Edit details option was removed when I open a non-started quiz, but there was no sign of an alert explaining why is the editing of resources disabled/impossible in both Firefox and Chrome.
In addition to that, the quiz preview is not working correctly (question images are not displayed), although I'm unsure if that regression is caused by changes in this PR.
| No alert | No preview |
|---|---|
Hmmm, thats strange , could you help me share the kolibri home folder that you used. Because it seems to be working on my end.
Hmmm, thats strange , could you help me share the kolibri home folder that you used. Because it seems to be working on my end.
@AllanOXDi I'll upload the whole home folder if you need it, but you already have the DB and logs attached in my previous comment (maybe all you would require is to import the QA channel...?)
@radinamatic this should be fixed now
Progress with the notification, but we're not there yet... After the upgrade to 0.18:
- quiz originally made on Kolibri 0.16 (but not started) now displays the notification and cannot be edited ✔️
- copy of that quiz that was originally created on 0.16 is not editable (is missing the Edit/Manage resources option) ❌ 😞
- even a brand new quiz created now on 0.18 cannot be edited (if not started) ❌ 😭
| 0.16 quiz | copy of 0.16 quiz | 0.18 quiz |
|---|---|---|
Seems as if the option to manage resources in quizzes that have not been started was disabled altogether 🤨
Walkthrough
This update introduces a warning alert in the quiz details header to notify users when a quiz originates from an older Kolibri version and cannot be edited directly. It also adjusts the logic for displaying the edit option in the quiz options dropdown, and adds a new translation string for the warning message.
Changes
| File(s) | Change Summary |
|---|---|
| kolibri/plugins/coach/assets/src/views/common/QuizLessonDetailsHeader.vue | Adds a dismissible warning alert for legacy quizzes using new computed properties and integrates a new string. |
| kolibri/plugins/coach/assets/src/views/quizzes/QuizSummaryPage/QuizOptionsDropdownMenu.vue | Updates logic to show edit option only for quizzes with data model version 3 or higher. |
| packages/kolibri-common/strings/searchAndFilterStrings.js | Adds a new translation string for the legacy quiz warning message. |
Sequence Diagram(s)
sequenceDiagram
participant User
participant QuizLessonDetailsHeader
participant searchAndFilterStrings
User->>QuizLessonDetailsHeader: View quiz details
QuizLessonDetailsHeader->>QuizLessonDetailsHeader: Check quiz properties (draft, active, data_model_version)
alt Quiz is from old Kolibri (draft=false, active=false, version<3)
QuizLessonDetailsHeader->>searchAndFilterStrings: Get warning string
QuizLessonDetailsHeader-->>User: Display warning alert
User->>QuizLessonDetailsHeader: Dismiss alert (optional)
end
Assessment against linked issues
| Objective | Addressed | Explanation |
|---|---|---|
| Add notice for pre-0.17.x quizzes which are not started (draft=false, active=false, version<3) (#12954) | ✅ |
📜 Recent review details
Configuration used: CodeRabbit UI Review profile: CHILL Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between ab4732706790682e05a164164b83806e87e74c3b and cdd3686a9403ee48fde72fd8ab6422e73b67304d.
📒 Files selected for processing (3)
-
kolibri/plugins/coach/assets/src/views/common/QuizLessonDetailsHeader.vue(5 hunks) -
kolibri/plugins/coach/assets/src/views/quizzes/QuizSummaryPage/QuizOptionsDropdownMenu.vue(2 hunks) -
packages/kolibri-common/strings/searchAndFilterStrings.js(1 hunks)
🔇 Additional comments (9)
packages/kolibri-common/strings/searchAndFilterStrings.js (1)
60-64: LGTM: Clear warning message for legacy quizzesThe translation string is well-structured with both the message text and context information, following the established pattern in this file. The message clearly explains the limitation and provides actionable guidance to users.
kolibri/plugins/coach/assets/src/views/quizzes/QuizSummaryPage/QuizOptionsDropdownMenu.vue (2)
36-38: LGTM: Clear computed property to check exam versionGood choice to create a descriptive computed property that encapsulates the version check logic. This improves code readability and maintainability.
47-48: LGTM: Correctly implemented condition for edit option visibilityThis change ensures that only quizzes with data model version 3 or higher (created in Kolibri 0.17.x or later) show the edit option, which aligns with the PR objectives.
kolibri/plugins/coach/assets/src/views/common/QuizLessonDetailsHeader.vue (6)
30-39: LGTM: Well-implemented warning alert for legacy quizzesThe alert is properly configured with warning type and dismissal functionality. The message clearly communicates that legacy quizzes cannot be edited directly and suggests creating a copy instead.
48-50: LGTM: Proper imports for alert functionalityAll necessary components and utilities are imported correctly.
60-64: LGTM: Well-structured setup functionThe setup function correctly imports and exposes the translation string function.
83-87: LGTM: Clear data property for alert visibilityThe
showAlertdata property is appropriately named and initialized to true, allowing the alert to be displayed by default and dismissed by the user.
99-110: LGTM: Well-organized computed properties with clear conditionalsThe computed properties are well-structured and clearly express their intent. The
isFromOldKolibriproperly combines conditions to show the warning only for quizzes that:
- Have an old data model version (< 3)
- Are not drafts (created before DraftExam model existed)
- Are not active (haven't been started yet)
This precisely targets the use case described in the PR objectives.
140-142: LGTM: Appropriate styling for the alert bannerThe margin-top creates appropriate spacing between the alert and surrounding elements.
✨ Finishing Touches
- [ ] 📝 Generate Docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
-
I pushed a fix in commit <commit_id>, please review it. -
Generate unit testing code for this file. -
Open a follow-up GitHub issue for this discussion.
-
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:-
@coderabbitai generate unit testing code for this file. -
@coderabbitai modularize this function.
-
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:-
@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase. -
@coderabbitai read src/utils.ts and generate unit testing code. -
@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format. -
@coderabbitai help me debug CodeRabbit configuration file.
-
Support
Need help? Create a ticket on our support page for assistance with any issues or questions.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
-
@coderabbitai pauseto pause the reviews on a PR. -
@coderabbitai resumeto resume the paused reviews. -
@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository. -
@coderabbitai full reviewto do a full review from scratch and review all the files again. -
@coderabbitai summaryto regenerate the summary of the PR. -
@coderabbitai generate docstringsto generate docstrings for this PR. -
@coderabbitai generate sequence diagramto generate a sequence diagram of the changes in this PR. -
@coderabbitai resolveresolve all the CodeRabbit review comments. -
@coderabbitai configurationto show the current CodeRabbit configuration for the repository. -
@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
@radinamatic - lower priority that 0.18.1 related work, but can we get a re-QA on this just to confirm everything is good to go after the last changes? It seems like Jacob added the "QA re-review" label after his last comment, so I'm guessing that even though he's done some manual testing, a final double-check would be helpful. Thank you!
Since we have a 0.18 branch, we don't have to be blocked by the string addition and this will be okay to merge into develop.
Confirming all the workflows that previously had issues are now working correctly:
- All quizzes created but not started in 0.16.2 display the proper notice
- All quizzes created but not started in 0.16.2 can be copied, copy edited and started, opened and completed by learners
- Quizzes started in 0.16.2 cannot be edited, just started and opened/completed by learners
- New quizzes can be created, started, opened/completed by learners, and ended.
Good job was done! 🚀