-
Notifications
You must be signed in to change notification settings - Fork 647
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
Add score in practice quiz #12564
base: develop
Are you sure you want to change the base?
Add score in practice quiz #12564
Conversation
…e ContentNodeProgressViewset
Build Artifacts
|
Hey @thesujai, thanks! Regarding frontend parts,
Was this a question for us? If so, we have some score calculations here That said, I'm not entirely sure what cards exactly you will need work on. Please send me a link to the card component that's used for a practice quiz. |
HI @MisRob |
Okay, it sounds you've got all you need then |
Concern: One approach could be to calculate num_questions and num_correct_attempts based on the criteria for completing the quiz. For instance, if a quiz is marked complete after 6 correct answers, then:
This way, the score and progress would be more aligned, avoiding confusion when the progress is 1 but the score seems low. |
@thesujai I am looping in @nucleogenesis here, since you mentioned you've already had some discussions regarding this together |
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.
@thesujai the query code looks good, but I'm honestly not entirely sure how best to display this information to the user.
So I think that what we need is a design decision (@jtamiace @rtibbles ) w/ regard to what we actually want to express to the user here.
We have three things:
- Total number of questions in the Practice quiz
total_questions
- Total time the user has attempted any question at all (correct or incorrect)
num_attempts
- The total number of questions the user has answered correctly
num_correct_attempts
(not the number of times questions are answered correctly, but the number of questions which have ever been answered correctly)
Example (not super realistic, but for demonstration/ensuring I'm understanding):
- Practice quiz with 5 questions
total_questions = 5
- User answers all of those questions incorrectly 3 times each
num_attempts = 15
- User answers the same question correctly 5 times
num_correct_attempts=1; num_attempts=20;
- User answers the rest of the questions correctly in a row
num_correct_attempts=5; num_attempts=24
So with these values... what do we want to tell the user? Are these the values we expect to use here or have I been misleading @thesujai in our discussions 😅
@thesujai after a quick chat w/ Richard I think I see the misunderstanding on my end. A "Practice Quiz" will not allow multiple attempts at the same question within the same "Quiz Attempt" -- that is to say, when you take a "Practice Quiz" it is treated like a "Quiz" in that you're going straight through it. Which means:
So if you only get the data for the last "AttemptLog" for the practice quiz, then you should have the correct data there. I'll give the code another look through w/ this in mind |
I understand why the linting failed here, but not why locally it passed |
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.
@thesujai this is great work. I see my practice quiz's most recent score and things worked as expected.
I found one non-blocking issue which I will make an issue for once we merge this PR. You've put so much work into this and I think this is good to merge. I'll leave final review to @rtibbles next week on the code side to get another set of eyes on the queries and such.
For posterity, once this is merged, we'll need to make an issue to address this:
When you complete an attempt at a practice quiz and go back to the page listing the contents, the old score is shown instead of the new score.
I gave it a quick look and couldn't quickly work out a good way to have it basically re-load the progress but I suspect there is a way.
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.
Noticed one thing w/ the string added
questionsLeftLabel: { | ||
message: '{remaining, number} questions left', | ||
context: | ||
"Indicates how many questions a learner has left to answer in a quiz. For example, it will show something like '5 questions left' or '1 question left' when a learner is taking a quiz.", | ||
}, |
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.
Ah - one blocking note here. I missed this was part of the diff in my initial review and thought it was pre-existing when I saw this.
We'll need to use ICU syntax for the word "questions" here which allows translators to translate the various ways of expressing an amount of something. A similar string is defined here in the QuizCard
component which demonstrates how this works where we can say "when the value of questionsLeft
is one
then the word is question
otherwise, use questions
".
You could probably just copy that string directly into the ProgressBar
component - note how you'll add a $tr: {}
object to that component, then add the string inside of that object 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.
Interesting! ✅
…dd so progress is not duplicated) and use trs for the score and questionLeft label
String change-request has been updated
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.
A couple of suggestions - ensuring we don't have an extraneous <p>
is blocking, in case it does unexpected things to layout.
} | ||
return 0; | ||
}, | ||
inProgressLabel() { |
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.
Might be good to specifically label this as quizInProgressLabel
so that it's clear that it is only being used in that circumstance.
} | ||
return ''; | ||
}, | ||
completedLabel() { |
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.
Likewise this could be quizCompletedLabel
. Otherwise it's slightly confusing why there is completedLabel
in the template above and then coreString('completedLabel')
below it.
@@ -9,18 +9,35 @@ | |||
:aria-valuenow="progress * 100" | |||
> | |||
<p | |||
v-if="completed" |
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 will add an extraneous <p>
tag in the case that it this is not a quiz and not completed. We should retain the v-if
but change it to:
v-if="completed || isQuiz"
{{ completedLabel }} | ||
</template> | ||
</template> | ||
<template v-else-if="completed"> |
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.
With the above tweak to the v-if
this can just be a v-else
instead.
Summary
Screenshot
References
Fixes #8643
Reviewer guidance
Please suggest if the reactivity needs to be improved
Testing checklist
PR process
Reviewer checklist
yarn
andpip
)