kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

adds notice for quizzes created pre-0.17.x

Open AllanOXDi opened this issue 11 months ago • 9 comments

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.

AllanOXDi avatar Jan 31 '25 19:01 AllanOXDi

Thank you both @akolson and @nucleogenesis . I will wait for the final thought from @radinamatic and @marcellamaki.

AllanOXDi avatar Feb 12 '25 14:02 AllanOXDi

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
2025-02-13_17-08-23 2025-02-13_17-19-43

db-logs.zip

radinamatic avatar Feb 13 '25 16:02 radinamatic

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 avatar Feb 13 '25 17:02 AllanOXDi

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 avatar Feb 13 '25 20:02 radinamatic

@radinamatic this should be fixed now

AllanOXDi avatar Mar 07 '25 14:03 AllanOXDi

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
2025-03-10_22-40-59 2025-03-10_22-43-17 2025-03-10_22-45-33

Seems as if the option to manage resources in quizzes that have not been started was disabled altogether 🤨

radinamatic avatar Mar 10 '25 21:03 radinamatic

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 quizzes

The 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 version

Good 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 visibility

This 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 quizzes

The 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 functionality

All necessary components and utilities are imported correctly.


60-64: LGTM: Well-structured setup function

The setup function correctly imports and exposes the translation string function.


83-87: LGTM: Clear data property for alert visibility

The showAlert data 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 conditionals

The computed properties are well-structured and clearly express their intent. The isFromOldKolibri properly combines conditions to show the warning only for quizzes that:

  1. Have an old data model version (< 3)
  2. Are not drafts (created before DraftExam model existed)
  3. 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 banner

The 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.

❤️ Share
🪧 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 @coderabbitai in 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 @coderabbitai in 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 pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file 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.

coderabbitai[bot] avatar May 06 '25 17:05 coderabbitai[bot]

@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.

marcellamaki avatar Jun 17 '25 18:06 marcellamaki

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! 🚀

radinamatic avatar Jun 25 '25 18:06 radinamatic