-
Notifications
You must be signed in to change notification settings - Fork 4k
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
feat: optional xblocks #34275
feat: optional xblocks #34275
Conversation
Thanks for the pull request, @DanielVZ96! Please note that it may take us up to several weeks or months to complete a review and merge your PR. Feel free to add as much of the following information to the ticket as you can:
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here. Please let us know once your PR is ready for our review and all tests are green. |
d9bb981
to
b1f6a46
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.
@DanielVZ96, the approach looks nice. However:
- The new editor is not displayed in Studio for me. I tried running
make lms-static && make lms-restart && make studio-static && make studio-restart
, but it's still not there. Am I missing some step? - We're implementing this for Palm first, so this PR should be opened against our fork. I'll close it now.
<h3 class="modal-section-title"> | ||
<input type="checkbox" id="optional_content" name="optional_content" | ||
class="input input-checkbox" /> | ||
<%- gettext('Mark as optional') %> |
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.
We should add an explanation (perhaps with the .field-message
class) to this field.
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.
~ .tip-warning { | ||
~.tip-warning { | ||
display: block; | ||
} | ||
|
||
// CASE: checked | ||
&:checked { | ||
~ .tip-warning { | ||
~.tip-warning { |
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 does not seem to be right. Why did we change 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.
sorry, autoformatting strikes again, will revert
@@ -238,6 +238,17 @@ class InheritanceMixin(XBlockMixin): | |||
scope=Scope.settings | |||
) | |||
|
|||
optional_content = Boolean( |
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.
Maybe something similar to optional_completion
would be better? The current name feels like this is related to grading, not the completion.
Same with the display_name
, the name of the new Studio editor, etc.
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.
good idea. will rename it.
@@ -0,0 +1,5 @@ | |||
<h3 class="modal-section-title"> |
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 whole editor is a h3
tag. The heading could simply be Completion
instead. See the cms/static/templates/grading-editor.underscore
as an example.
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.
@@ -54,6 +54,7 @@ def get_blocks(self, block): # pylint: disable=missing-function-docstring | |||
'resume_block': block.get('resume_block', False), | |||
'type': block_type, | |||
'has_scheduled_content': block.get('has_scheduled_content'), | |||
'optional_content': block.get('optional_content'), |
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.
Please read this:
edx-platform/openedx/core/djangoapps/content/block_structure/transformer.py
Lines 16 to 57 in b1f6a46
# All Transformers are expected to maintain version-related class | |
# attributes. While the values for the base class is set to 0, | |
# the values for each concrete transformer should be 1 or higher. | |
# | |
# A transformer's version attributes are used by the block_structure | |
# framework in order to determine whether any collected data for a | |
# transformer is outdated because of a data schema change by the | |
# transformer. | |
# | |
# The WRITE_VERSION number is stored along with the transformer's | |
# data when it is collected and cached (during the collect phase). | |
# The READ_VERSION number is then verified to be less than or equal | |
# to the version associated with the collected data when the | |
# collected data is accessed (during the transform phase). | |
# | |
# We distinguish between WRITE_VERSION and READ_VERSION numbers in | |
# order to: | |
# 1. support blue-green deployments where new and previous versions | |
# of the code base are simultaneously executing on different | |
# workers for a period of time. | |
# | |
# A 2-phase deployment is used to stagger read and write changes. | |
# | |
# 2. scale for large deployments where it is costly to recompute | |
# block structures for all courses when a transformer's collected | |
# data schema changes. | |
# | |
# A background management command is run to prime the new data. | |
# | |
# See the following document for further information: | |
# https://openedx.atlassian.net/wiki/display/MA/Block+Structure+Cache+Invalidation+Proposal | |
# | |
# The WRITE_VERSION number of a Transformer should be incremented | |
# when it's collect implementation is additively changed. Backward | |
# compatibility should be maintained with previous READ_VERSIONs | |
# until all readers are updated. | |
# | |
# The READ_VERSION number of a Transformer should be incremented | |
# when its transform implementation is updated to make use of the | |
# newly collected data - and released only after all collected | |
# block structures are updated with the new WRITE_VERSION. | |
# |
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.
@Agrendalath so based on that I should bump the block_completion transformer write version, and after we're sure all blocks have the new version, we bump the read version?
@@ -1245,10 +1285,10 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview', | |||
} | |||
]; | |||
if (xblockInfo.isChapter()) { | |||
tabs[0].editors = [ReleaseDateEditor]; | |||
tabs[0].editors = [ReleaseDateEditor, OptionalContentEditor]; |
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.
Could we show the editor only when the completion is enabled (ENABLE_COMPLETION_TRACKING_SWITCH.is_enabled()
)?
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.
@Agrendalath I'm not sure how to implement that. can we do that in a followup ticket?
tabs[1].editors = [StaffLockEditor]; | ||
} else if (xblockInfo.isSequential()) { | ||
tabs[0].editors = [ReleaseDateEditor, GradingEditor, DueDateEditor]; | ||
tabs[0].editors = [ReleaseDateEditor, GradingEditor, DueDateEditor, OptionalContentEditor]; |
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.
We should allow overriding this in Units as well.
if optional != _is_optional(section_key, subsection_key, unit_key): | ||
continue |
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.
What if the section
sets the value of the optional_content
field to True
but the subsection
sets it to False
? Would it make sense to disallow marking subsection
as non-optional when its parent section
is marked as optional?
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 was handling it as if a parent was optional all children would behave as optional regardless of their actual value, but now that you mention it, in order to reduce confusion it'd be better to disable the checkbox when a parent is optional.
@DanielVZ96 Even though your pull request wasn’t merged, please take a moment to answer a two question survey so we can improve your experience in the future. |
Description
This PR implements separating optional progress from normal progress, and also displaying optional chapters and sequences in the outline.
Supporting information
Testing instructions
Screenshots
Private-ref: BB-8586