Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds notice for quizzes created pre-0.17.x #13045

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

AllanOXDi
Copy link
Member

@AllanOXDi AllanOXDi commented Jan 31, 2025

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

@github-actions github-actions bot added APP: Coach Re: Coach App (lessons, quizzes, groups, reports, etc.) DEV: frontend labels Jan 31, 2025
@AllanOXDi AllanOXDi requested a review from radinamatic February 6, 2025 16:57
@@ -41,7 +41,7 @@
},
{ label: this.coreString('deleteAction'), value: 'DELETE' },
];
if (!this.exam?.archive) {
if (this.exam?.data_model_version > 2) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@radinamatic @marcellamaki @nucleogenesis . I think we should disabled the edit details all together if the data_modal_version < 3 ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sort of crossed my mind too, when I was considering the string... 🤔

But Edit details (quiz title and description, not the resources) should still be available, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm- I think no- You have to first make a copy to do that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that hiding it is a good call. This is a very unlikely case for someone to be in and the solution is clearly shown to the user w/ the changes here

@AllanOXDi AllanOXDi marked this pull request as ready for review February 6, 2025 17:05
@AllanOXDi AllanOXDi force-pushed the adds-notice-for-older-quizzes branch from 7f086c1 to 7a96110 Compare February 6, 2025 17:08
@nucleogenesis nucleogenesis self-assigned this Feb 11, 2025
@@ -41,7 +41,7 @@
},
{ label: this.coreString('deleteAction'), value: 'DELETE' },
];
if (!this.exam?.archive) {
if (this.exam?.data_model_version > 2) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that hiding it is a good call. This is a very unlikely case for someone to be in and the solution is clearly shown to the user w/ the changes here

@@ -72,6 +86,9 @@
resource() {
return this.examOrLesson === 'lesson' ? this.lesson : this.exam;
},
isFromOldKolibiri() {
return this.exam.data_model_version < 3 && this.exam.draft && !this.exam.active;
Copy link
Member

@nucleogenesis nucleogenesis Feb 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the notice and I believe it's because of the this.exam.draft which is only set on DraftExam models.

Because the quiz was created before DraftExam models existed, they're not going to be marked as a draft here.

I made the change locally and see the banner as expected.

Copy link
Member

@nucleogenesis nucleogenesis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

A few comments below that I think can be updated. You might want to check directly w/ @radinamatic or @marcellamaki tomorrow re: the color of the notice.

One other thing to add is that there should probably be a half-em of margin above the UiAlert so that there's some room between it and the title+buttons when shown.

@@ -27,6 +27,11 @@
</div>
</div>
<MissingResourceAlert v-if="resource.missing_resource" />
<UiAlert v-if="isFromOldKolibiri">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably add type="warning" here - thoughts @radinamatic ?

The default "info" type results in a blue section w/ an info (i) icon, but warning is yellow w/ the /!\ triangle exclamation icon.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed on both accounts @nucleogenesis (re: margin and), yellow color for the notice/alert may be better suited for this case 👍🏽

@@ -72,6 +86,9 @@
resource() {
return this.examOrLesson === 'lesson' ? this.lesson : this.exam;
},
isFromOldKolibiri() {
return this.exam.data_model_version < 3 && this.exam.draft && !this.exam.active;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could refactor this into several props instead for better clarity, testability and maintainability;

isOldDataModelVersion() {
    return this.exam.data_model_version < 3;
}

isDraft() {
    return this.exam.draft;
}

isActive() {
    return this.exam.active; 
}

isFromOldKolibiri() {
    return this.isOldDataModelVersion() && this.isDraft() && !this.isActive();
}

And in the alert, it would now be;

<UiAlert v-if="isFromOldKolibiri">
    .....
</UiAlert>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should take into consideration @nucleogenesis's feedback here and here

@@ -41,7 +41,7 @@
},
{ label: this.coreString('deleteAction'), value: 'DELETE' },
];
if (!this.exam?.archive) {
if (this.exam?.data_model_version > 2) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would 3 represent our most current exam?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes and it would means it comes after DraftExam existed.

Copy link
Member

@akolson akolson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @AllanOXDi! I think this is looking great already. I left you a thought and question. I also think we could easily write up tests for the newly added notice based on the different scenarios described in the isFromOldKolibiri.

@AllanOXDi
Copy link
Member Author

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

@radinamatic
Copy link
Member

radinamatic commented Feb 13, 2025

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

@AllanOXDi
Copy link
Member Author

Hmmm, thats strange , could you help me share the kolibri home folder that you used. Because it seems to be working on my end.

@radinamatic
Copy link
Member

radinamatic commented Feb 13, 2025

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...?)

@AllanOXDi AllanOXDi force-pushed the adds-notice-for-older-quizzes branch from f4637f5 to 485a60a Compare March 7, 2025 14:14
@AllanOXDi
Copy link
Member Author

@radinamatic this should be fixed now

Copy link
Member

@marcellamaki marcellamaki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @AllanOXDi - I'll let @radinamatic follow up on the QA side here, but I have two small requests in terms of variable naming that would help with readability. Let me know if you have any questions!

isOldDataModelVersion() {
return this.exam.data_model_version < 3;
},
isFromOldKolibiri() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have a small typo here - it's consistent, but let's update isFromOldKolibiri to isFromOldKolibri

v-if="isFromOldKolibiri && hideAlert"
type="warning"
class="old-kolibri-banner"
@dismiss="hideAlert = false"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm finding the hideAlert here a little bit confusing. When I see that variable name, I would assume that it means that the UiAlert is not visible. However, since isFromOldKolibiri && hideAlert would have to be true for this to render, it means that hideAlert would be true for this to show. And, the @dismiss setting hideAlert to false.

I think having this be showAlert would be clearer.

@radinamatic
Copy link
Member

radinamatic commented Mar 10, 2025

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 🤨

@@ -41,7 +41,7 @@
},
{ label: this.coreString('deleteAction'), value: 'DELETE' },
];
if (!this.exam?.archive) {
if (!this.exam?.data_model_version > 2) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the ! here is making for the condition being the opposite of what is expected as we only want the editAction to show when the quiz is data_model_version > 2.

I think this is the cause of @radinamatic 's last report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
APP: Coach Re: Coach App (lessons, quizzes, groups, reports, etc.) DEV: frontend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add notice for pre-0.17.x quizzes which are not started (gracefully handle edge case)
5 participants