-
Notifications
You must be signed in to change notification settings - Fork 4.2k
[BD-38][TNL-7615] [BB-4846] feat: Add discussion_enabled for Unit #28864
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
[BD-38][TNL-7615] [BB-4846] feat: Add discussion_enabled for Unit #28864
Conversation
|
Thanks for the pull request, @farhaanbukhsh! I've created BLENDED-977 to keep track of it in Jira. More details are on the BD-38 project page. When this pull request is ready, tag your edX technical lead. |
50dffa8 to
46f79bd
Compare
|
@farhaanbukhsh Thank you for your contribution. |
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 should be moved to SequenceFields
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.
That makes sense this only had the logic and not the fields. I should have noted this earlier 😅
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.
@xitij2000 there is just one issue when I move this field to SequenceFields the MongoDB calls increase since now any Xblock that uses SequenceMixin will also have dscussion_enabled do you think creating another mixin to just add the discussion enabled field will be a better solution? Since then it will make way lesser call than now.
Depending on this I can make the changes to make the tests pass. :)
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 sure, to be honest. Let's keep it here for now. I'd like to get feedback from someone who understands this better.
8627544 to
df16ce5
Compare
tinuademargaret
left a comment
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 tested that this PR adds a discussion_enabled flag to each unit
- I read through the code
-
I checked for accessibility issuesNA -
Includes documentationNA -
I made sure any change in configuration variables is reflected in the corresponding client'sNAconfiguration-securerepository.
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.
Should the discussion here start with D? I think Title case is the intent here, right?
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.
@tinumide I thinks this is okay :)
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.
It won't show up anywhere, but I think this should be changed to:
| "Add discussion for the Unit." | |
| "Enable in-context discussions for the Unit." |
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.
Wow, this is a huge increase. Do you know why?
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.
@xitij2000 IIUC when we introduce a new field the "find" call takes that into consideration and to generate the xml/tree it makes these extra calls.
|
@farhaanbukhsh - Can you please add the "[BD-38]" label to this PR to ensure our workflow automation picks this request up and handles it appropriately? Thanks! |
Added, thanks @jristau1984 😄 |
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.
| scope=Scope.content, | |
| scope=Scope.settings, |
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 you should move this to a new mixin class for VerticalBlock called VerticalFields so that it's only added to the vertical block.
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.
Why have the calls increased so drastically from 38 to 131?
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.
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.
hey @saadyousafarbi and @awaisdar001, I don't know the concrete reason yet, I will try to dig down on the calls and see what is going on.
But on a shallow level, this looks like when a new field is introduced the new find calls are made and since this field is introduced in SequenceFields so all places that are using Sequence Field and Sequence Mixing are going to do additional find calls. This seems to be bumping the number of calls, I will dig deeper and get to the bottom of this and probably I will have better proof.
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.
thanks that would be helpful.
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.
@saadyousafarbi, @awaisdar001: Thank you for flagging this. That is a serious performance regression, and is definitely something we would want to avoid merging if possible.
@farhaanbukhsh: I suspect this is because your new XBlock field is content scoped–meaning that it gets put in a separate definition doc for each sequence, which is constantly being reloaded every time that field is accessed in outline traversal operations. If that's the case, switching it to settings scope as @xitij2000 suggested should take care of it (that will place all data for the field across all instances of the course in one structure document).
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.
FYI @edx/perf-interest
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.
@ormsbee I think the content scoping is the issue. I've tested locally by setting the scope of settings and the counts remain the same.
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.
@ormsbee @xitij2000 That's a beautiful catch :)
The scope change did make the calls come back to normal for me on my devstack. I am still waiting for the tests to run on the CI.
cms/djangoapps/contentstore/views/tests/test_discussion_enabled.py
Outdated
Show resolved
Hide resolved
cms/djangoapps/contentstore/views/tests/test_discussion_enabled.py
Outdated
Show resolved
Hide resolved
cms/djangoapps/contentstore/views/tests/test_discussion_enabled.py
Outdated
Show resolved
Hide resolved
cms/djangoapps/contentstore/views/tests/test_discussion_enabled.py
Outdated
Show resolved
Hide resolved
|
jenkins run all |
911a805 to
0a0867d
Compare
|
@awaisdar001 This is ready for review :) |
xitij2000
left a comment
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 tested this: tested by checking for the field via python shell
- I read through the code
- [na] I checked for accessibility issues
- [na] Includes documentation
cms/djangoapps/contentstore/views/tests/test_discussion_enabled.py
Outdated
Show resolved
Hide resolved
awaisdar001
left a comment
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.
Pass - 2 done, I just have one question regarding the code raising "JSONDecodeError" when a user is not authorized to get/set vertical discussion status. otherwise the PR looks good to know.
saadyousafarbi
left a comment
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.
can you address the questions by @awaisdar001 on the PR?
Other than that, this looks good!
awaisdar001
left a comment
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.
thanks, looks good to me.
👍 once the tests pass.
|
fyi @ormsbee if you would like another look at the PR. |
0b0cd72 to
8ea281a
Compare
|
@farhaanbukhsh can you rebase and squash the commits? |
For each unit discussion_enabled flag is added so that each unit can be made discussable when needed. Signed-off-by: Farhaan Bukhsh <farhaan@opencraft.com>
6bfb236 to
f1ce013
Compare
|
Your PR has finished running tests. There were no failures. |
@awaisdar001 done :) |
|
@awaisdar001 Is this good to merge? |
|
Yes - Merged!! |
|
@farhaanbukhsh 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
|
EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production. |
|
EdX Release Notice: This PR has been deployed to the production environment. |
This PR adds a discussion_enabled flag to each unit, so that instead of adding an xblocks for discussion,
the user can enable it using a checkbox or a switch. This is just an API-level implementation.
JIRA tickets: BB-4846, TNL-7615
Discussions: Link to any public dicussions about this PR or the design/architecture. Otherwise omit this.Dependencies: None
Screenshots: Always include screenshots if there is any change to the UI.Sandbox URL: TBD - sandbox is being provisioned.Merge deadline: "None" if there's no rush, "ASAP" if it's critical, or provide a specific date if there is one.Testing instructions:
Running the tests is the best way to see it working,
Author notes and concerns:
A lot of inspiration is taken from https://github.com/edx/edx-platform/pull/24380
Reviewers