-
Notifications
You must be signed in to change notification settings - Fork 176
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 completion criteria to the side panel #4059
Add completion criteria to the side panel #4059
Conversation
- move shared strings to metadata strings - remove unused strings
0cc6b70
to
d5c41c6
Compare
case CompletionCriteriaModels.TIME: | ||
labels.completion = metadataStrings.$tr('completeDuration'); | ||
if (suggestedDuration) { | ||
labels.duration = secondsToHms(suggestedDuration); |
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 entirely sure if I should be using the suggested duration (node.suggested_duration
) or rather threshold value (node.extra_fields.options.completion_criteria.threshold
). Often, these two values are the same. Advice?
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 a great question and it's not something I would have noticed just doing a read through without you pointing it out. Looking over the code, I think it would be good to use the threshold
value here because there a few edge case scenarios when the type of duration could change, where the threshold
is reset, but not the suggested_duration
I just tried this out to confirm I was remembering correctly.
First, I change the value from the default on EPUB to "Short Activity"
Then, I change back to "viewed in it's entirety"
You will see here that the suggested_duration
is not replaced, but the threshold is updated. So, this could be a scenario where displaying the suggested_duration
(even doing a conditionality check) could cause a mismatch.
There is a probably another conversation to be had about whether we want to make any further adjustments to the model logic here, but recalling how challenging it was, I don't think that's wise to get into so close to release.
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 think this was intentional - the non-changing of the suggested_duration is to retain a suggested duration value, even when the threshold no longer records any sort of duration value.
With that in mind, I think sticking with the suggested_duration makes the most sense, as it retains a value that is displayed to the user in Kolibri, even when the completion criteria is changed to one that does not store any duration value.
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.
Thank you, both.
In the future, could an option to set the suggested duration separately from the completion criteria on the edit modal bring some more clarity to this, or was it discussed already? It's a bit confusing, but primarily it seems that with this approach, there'd be no other way to update the suggested duration of a resource than to change the completion criteria to one that allows duration adjustment and then switch back to the original completion criteria.
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 @MisRob - the code read through here looks good. Your question about threshold
vs suggested_duration
was a good one and made me think! I think using threshold
is the way to go, so I've requested changes here, but might be good to see if @rtibbles agrees.
But, since we are pushing ahead to Studio string freeze, I also feel okay about merging this if needed today and making that slight adjustment in follow up. (cc @bjester)
case CompletionCriteriaModels.TIME: | ||
labels.completion = metadataStrings.$tr('completeDuration'); | ||
if (suggestedDuration) { | ||
labels.duration = secondsToHms(suggestedDuration); |
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 a great question and it's not something I would have noticed just doing a read through without you pointing it out. Looking over the code, I think it would be good to use the threshold
value here because there a few edge case scenarios when the type of duration could change, where the threshold
is reset, but not the suggested_duration
I just tried this out to confirm I was remembering correctly.
First, I change the value from the default on EPUB to "Short Activity"
Then, I change back to "viewed in it's entirety"
You will see here that the suggested_duration
is not replaced, but the threshold is updated. So, this could be a scenario where displaying the suggested_duration
(even doing a conditionality check) could cause a mismatch.
There is a probably another conversation to be had about whether we want to make any further adjustments to the model logic here, but recalling how challenging it was, I don't think that's wise to get into so close to release.
Summary
Resource
Exercise
Manual verification steps performed
Set completion and duration in the edit modal for various resource types and exercises.
Does this introduce any tech-debt items?
Reviewer guidance
How can a reviewer test these changes?
References
Contributor's Checklist
PR process:
CHANGELOG
label been added to this PR. Note: items with this label will be added to the CHANGELOG at a later timeIf this includes an internal dependency change, a link to the diff is providedThedocs
label has been added if this introduces a change that needs to be updated in the user docs?If any Python requirements have changed, the updatedrequirements.txt
files also included in this PROpportunities for using Google Analytics here are notedMigrations are safe for a large dbStudio-specifc:
notranslate
class been added to elements that shouldn't be translated by Google Chrome's automatic translation feature (e.g. icons, user-generated text)pages
,components
, andlayouts
directories as described in the docsUsers' storage used is recalculated properly on any changes to main tree filesIf there new ways this uses user data that needs to be factored into our Privacy Policy, it has been noted.Testing:
Reviewer's Checklist
This section is for reviewers to fill out.
yarn
andpip
)