Skip to content

Conversation

@DanielVZ96
Copy link

@DanielVZ96 DanielVZ96 commented Feb 29, 2024

Description

This PR implements separating optional progress from normal progress, and also displaying optional chapters and sequences in the outline.

  • Impacts: Learners and authors

Supporting information

Testing instructions

  1. Run the MFE from this branch: feat: optional xblocks openedx/frontend-app-learning#1296
  2. Add "done" to the advanced module list
  3. As a non-staff user go to the progress tab and assert only the typical progress donut appears
  4. As a staff user, on the cms open the settings of any sequence or chapter and mark as optional
  5. As a non-staff user, complete some units, and also the optional unit
  6. Navigate to the progress tab again and assert a new optional donut appears with your progress

Screenshots

optional-outline

cms-optional

progress

course-settings

Private-ref: https://tasks.opencraft.com/browse/BB-8586

Comment on lines 1241 to 1242
Copy link
Member

Choose a reason for hiding this comment

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

Nit: we should not mix the snake_case with camelCase.

Copy link
Author

Choose a reason for hiding this comment

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

fixed

Copy link
Member

Choose a reason for hiding this comment

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

Actually, this seems to be a backward-compatible change, so we can revert bumping this version.

Copy link
Author

Choose a reason for hiding this comment

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

reverted

Copy link
Member

Choose a reason for hiding this comment

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

Nit: can we use a more verbose name for this test, like "test_optional_completion_off_by_default"?

Copy link
Author

Choose a reason for hiding this comment

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

good idea!

Comment on lines 1410 to 1411
Copy link
Member

Choose a reason for hiding this comment

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

What if the optional_completion is set to False (default), but the parent XBlock has it set to True? In this use case, the field is still active. We should disable this checkbox when ancestor_has_optional_completion returns True, regardless of the xblock_info['optional_completion'] value.

Copy link
Author

Choose a reason for hiding this comment

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

good point

Copy link
Member

Choose a reason for hiding this comment

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

Regarding this comment about hiding the editor when the completion tracking is not enabled, please see the following parts of code that handle a similar scenario for another editor:

is_custom_relative_dates_active: ${CUSTOM_RELATIVE_DATES.is_enabled(context_course.id) | n, dump_js_escaped_json},

https://github.com/open-craft/edx-platform/blob/42451caa2612a63b42bf5686e6217817e0dd2098/cms/static/js/views/modals/course_outline_modals.js#L1290-L1292

I think we shouldn't move this to a follow-up ticket because this feature is not enabled by default in edx-platform.

Copy link
Author

Choose a reason for hiding this comment

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

wow i didn't realize it'd be so straight forward. implementing this

Copy link
Author

Choose a reason for hiding this comment

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

done. I wasn't able to test it manually without hardcoding the value in the base.html. it seems waffle flags are cached somewhere and take quite some time to invalidate the cache.

In case you want to test it and have my same problem you can hard code completion_tracking_enabled to False in cms/templates/base.html line 162.

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<% var message = gettext('Optional %(xblockType)ss won\'t count towards course or parent completion. Only has an effect if completion module is enabled.') %>
<% var message = gettext('Optional %(xblockType)ss won\'t count towards course or parent completion.') %>

Once we hide the editor when the completion tracking is not enabled, we can remove this part.

Copy link
Author

Choose a reason for hiding this comment

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

done

@DanielVZ96 DanielVZ96 requested a review from Agrendalath March 10, 2024 01:46
@DanielVZ96 DanielVZ96 force-pushed the dvz/optional-lesson branch 2 times, most recently from 487ae2d to a2968d0 Compare March 23, 2024 06:13
Copy link
Member

Choose a reason for hiding this comment

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

@DanielVZ96, the completion tracking should be enabled for the course instead of the section.

Also, you should be able to use something like console.warn(window. course) to verify that it's applied correctly.

@DanielVZ96 DanielVZ96 force-pushed the dvz/optional-lesson branch 18 times, most recently from 3f0b03c to f7745fd Compare March 31, 2024 05:41
@DanielVZ96 DanielVZ96 force-pushed the dvz/optional-lesson branch 18 times, most recently from 3046507 to 84ad5ee Compare April 2, 2024 11:53
@DanielVZ96 DanielVZ96 requested a review from Agrendalath April 4, 2024 04:46
@Agrendalath Agrendalath force-pushed the dvz/optional-lesson branch from d1618cb to e57c355 Compare April 30, 2024 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants