-
Notifications
You must be signed in to change notification settings - Fork 726
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
Update preview plan quiz #12685
Update preview plan quiz #12685
Conversation
Build Artifacts
|
4ce565d
to
35f1795
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @AlexVelezLl - this looks great and is very nearly there! I did notice one problem with viewing "not started" quizzes due to some underlying assumptions in the "item stats" functions in the handlers. I think conditionalizing it might be the simplest path forward, and I added a few more details inline.
It's okay for this to wait until after your trip to the mentor summit! It's not blocking other work that we will be working on next week.
@@ -20,6 +20,7 @@ | |||
/> | |||
</h1> | |||
<StatusElapsedTime | |||
v-if="examOrLesson !== 'exam'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is curiosity, not a leading question -- I can't quite figure out why this change is needed just from reading the diff. I can see that this component (the file QuizLessonDetailsHeader
is used in other changed files, and that the StatusElapsedTime
has also been updated. No need to add a code comment, but can you just explain to me? It's probably very straightforward but I just can't quite get there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh the thing is that we use this QuizLessonDetailsHeader
for quizzes and lessons. And we were updating the quiz page to have the creation time as part of the QuizStatus
component, so in the figma spec we have that we dont need to show the creation time here in the header anymore.
But as this header component was also being used for lessons, and we dont have yet the creation time in the LessonStatus
component (which I assumed will be part of another issue to update the lessons page), I preferred to put this conditional of v-if="examOrLesson !== 'exam'"
so that it is not shown in the quizzes as it is in the figma spec, but not "accidentally" remove it from the lessons yet, and rather do it on purpose once the lessons page has been refactored.
|
||
// quizIsRandomized() { | ||
// return !this.quiz.learners_see_fixed_order; | ||
// }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this and for the "orderDescriptionString" - both have been commented out. Will we need them going forward?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoooppsss I forgot to remove them
component: QuizSummaryPage, | ||
handler: generateQuestionListHandler(['quizId']), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This handler, in a very not-straightforward way, is working in some cases, but causing a 500 error when you open a quiz that has not yet been started. Another function within the handler is dispatching questionList/setItemStats
, which is assuming that QuizDifficulties
(aka "Difficult Questions") exists.
One way to go might be to updates the setItemsStats
action, to me that seems as though it would be simpler to conditionalize that, rather that to recreate a similar action to build state for draft quizzes. It also seems to only be called in that one function (showQuestionListView
), so I think there would be minimal chance of regression.
@rtibbles any thoughts here re: coach handlers/state management that I'm not thinking of?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the main thing is that for a draft quiz, we will get 500s because things are missing. We should update the API endpoint that is returning a 500, to instead return a 404 when the quiz is only a draft, and then make the handler handle the 404 gracefully (or just not even try it if it already knows the quiz is a draft).
More generally, most of the reports stuff is inapplicable when a quiz is still a draft, so we may need to utilize empty states here well too, and disabling tabs when not applicable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the code read through, I think there are already updates in the UI for empty state when not applicable, but the data is still being fetched (or, trying to be and erroring)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is also with the handler, I havent looked in deph all that it was doing, but it was fetching de exam and the resources again, but we dont need this, as we already do this in the fetchQuizSummaryPageData. So I will better remove this handler for this route and handle this within the fetchQuizSummaryPage function, and conditionally fetch the difficult questions if the exam is not a draft.
so we may need to utilize empty states here well too, and disabling tabs when not applicable?
Yes, we currently have a condition to not show the tab if the quiz is a draft: https://github.com/AlexVelezLl/kolibri/blob/d915ea27c67992f6a9c290f618bffaa004f33e52/kolibri/plugins/coach/assets/src/views/plan/QuizSummaryPage/index.vue#L204
Thank you @marcellamaki!! I have pushed the changes. At the end I fixed the 500 error in the api (just in case), and also removed the |
The code updates here make sense to me, and a quick manual testing checks out. I'm going to ask @pcenov to do some extra manual QA next week, but I think this is looking good! |
qs = [...qs, ...section.questions]; | ||
|
||
return qs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking: You could return [...qs, ...section.questions]
here rather than assigning to the qs
and returning it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes, that would be much more simpler. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may be mistaken or missing something re: my comment around the ?.()
but I'll consider it a blocking change until we can clarify.
}); | ||
}, | ||
exportCSV() { | ||
this.$refs.table.exportCSV?.(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that the ?.
will avoid the error here. I tried this out in the node repl. I think that this is a blocker unless it's fully expected for exportCSV
to not be defined, in which case this can be rewritten to avoid the resulting errors in the console.
> x = {a: 1}
{ a: 1 }
> x.a?.()
Uncaught TypeError: x.a is not a function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, no, no, the ?.()
is not supposed to be a validator to see if the exportCSV
is a function, but rather that it is defined, and avoid breaking if its not. exportCSV
is a very specific identifier and it is a verb, so having a non-function exportCSV
attribute defined within the table ref component sounds like a very edge case. We could also write a couple of lines to make the validation validation more robust if needed, and just do
if (typeof this.$refs.table.exportCSV === 'function') {
this.$refs.table.exportCSV();
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the end, I just updated this, just in case, to make the typeof validation. 👐
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right on, thanks Alex. That makes sense and this way avoids the possible error altogether.
LGTM as well @marcellamaki - no issues observed while manually testing other than the 'Preview' button not working and clicking the Back button which currently brings us to the Reports tab but both of these are out of scope for this PR. |
Thank you @nucleogenesis! I just pushed the changes :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Alex, the changes LGTM!
Thank you all! |
Summary
Update quiz summary page to:
preview
button in the headerNote that I havent updated page back buttons actions, as we will probably reestructure page routes in the future, and dont want to mess with it yet.
References
Closes #12671.
Screenshots
Reviewer guidance
Check that current quiz summary page match the acceptance criteria described in #12671.
Testing checklist
PR process
Reviewer checklist
yarn
andpip
)