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

Add completion criteria to the side panel #4059

Merged

Conversation

MisRob
Copy link
Member

@MisRob MisRob commented May 5, 2023

Summary

  • Displays "Completion" and "Duration" metadata in the resource side panel

channel edit

  • Adds new strings for related error messages to be likely used in the upcoming work

Resource

Edit modal settings Reference material Viewed in its entirety When time spent is equal to duration - Short activity When time spent is equal to duration - Long activity When time spent is equal to duration - Time to complete Determined by the resource
Side panel Screenshot from 2023-05-05 14-45-17 Viewed in its entirety Screenshot from 2023-05-05 14-44-43 Screenshot from 2023-05-05 14-44-57 Screenshot from 2023-05-05 14-44-22 determined

Exercise

Edit modal settings Practice quiz Goal 100% Goal m of n Goal 2 in a row Goal 3 in a row Goal 5 in a row Goal 10 in a row
Side panel quiz goal-100 m-of-n row-2 goal-3 goal-5 goal-10

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?

  • We have some strings that we are currently not using. This was agreed on beforehand due to the string freeze
  • Error messages are not implemented yet, some further clarification is needed (will follow up)

Reviewer guidance

How can a reviewer test these changes?

  • see "Manual verification steps performed"
  • @radinamatic you're welcome to check context messages for strings

References

Contributor's Checklist

PR process:

  • If this is an important user-facing change, PR or related issue the CHANGELOG label been added to this PR. Note: items with this label will be added to the CHANGELOG at a later time
  • If this includes an internal dependency change, a link to the diff is provided
  • The docs 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 updated requirements.txt files also included in this PR
  • Opportunities for using Google Analytics here are noted
  • Migrations are safe for a large db

Studio-specifc:

  • All user-facing strings are translated properly
  • The notranslate class been added to elements that shouldn't be translated by Google Chrome's automatic translation feature (e.g. icons, user-generated text)
  • All UI components are LTR and RTL compliant
  • Views are organized into pages, components, and layouts directories as described in the docs
  • Users' storage used is recalculated properly on any changes to main tree files
  • If there new ways this uses user data that needs to be factored into our Privacy Policy, it has been noted.

Testing:

  • Code is clean and well-commented
  • Contributor has fully tested the PR manually
  • If there are any front-end changes, before/after screenshots are included
  • Critical user journeys are covered by Gherkin stories
  • Any new interactions have been added to the QA Sheet
  • Critical and brittle code paths are covered by unit tests

Reviewer's Checklist

This section is for reviewers to fill out.

  • Automated test coverage is satisfactory
  • PR is fully functional
  • PR has been tested for accessibility regressions
  • External dependency files were updated if necessary (yarn and pip)
  • Documentation is updated
  • Contributor is in AUTHORS.md

case CompletionCriteriaModels.TIME:
labels.completion = metadataStrings.$tr('completeDuration');
if (suggestedDuration) {
labels.duration = secondsToHms(suggestedDuration);
Copy link
Member Author

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?

Copy link
Member

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"
Screenshot 2023-05-08 at 10 53 26 AM

Then, I change back to "viewed in it's entirety"
Screenshot 2023-05-08 at 10 53 47 AM

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.

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

Copy link
Member Author

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.

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 @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);
Copy link
Member

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"
Screenshot 2023-05-08 at 10 53 26 AM

Then, I change back to "viewed in it's entirety"
Screenshot 2023-05-08 at 10 53 47 AM

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.

@marcellamaki marcellamaki self-requested a review May 8, 2023 18:03
@marcellamaki marcellamaki merged commit 1797ae1 into learningequality:unstable May 8, 2023
@MisRob MisRob deleted the fix-missing-completion branch November 28, 2023 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Previewer metadata - Missing 'Completion' metadata
3 participants