Skip to content

Conversation

@farhaanbukhsh
Copy link
Member

@farhaanbukhsh farhaanbukhsh commented Sep 28, 2021

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

@openedx-webhooks openedx-webhooks added needs triage open-source-contribution PR author is not from Axim or 2U labels Sep 28, 2021
@openedx-webhooks
Copy link

openedx-webhooks commented Sep 28, 2021

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.

@farhaanbukhsh farhaanbukhsh force-pushed the farhaan/bb-4846-add-discussion-enabled-flag branch from 50dffa8 to 46f79bd Compare September 28, 2021 17:17
@natabene
Copy link
Contributor

@farhaanbukhsh Thank you for your contribution.

Comment on lines 53 to 60
Copy link
Contributor

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

Copy link
Member Author

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 😅

Copy link
Member Author

@farhaanbukhsh farhaanbukhsh Sep 30, 2021

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

Copy link
Contributor

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.

@farhaanbukhsh farhaanbukhsh force-pushed the farhaan/bb-4846-add-discussion-enabled-flag branch 3 times, most recently from 8627544 to df16ce5 Compare September 30, 2021 06:18
Copy link
Contributor

@tinuademargaret tinuademargaret left a 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 issues NA
  • Includes documentation NA
  • I made sure any change in configuration variables is reflected in the corresponding client's configuration-secure repository. NA

Copy link
Contributor

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?

Copy link
Member Author

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 :)

Copy link
Contributor

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:

Suggested change
"Add discussion for the Unit."
"Enable in-context discussions for the Unit."

Comment on lines 158 to 160
Copy link
Contributor

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?

Copy link
Member Author

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.

@jristau1984
Copy link
Contributor

@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!

@farhaanbukhsh farhaanbukhsh changed the title [TNL-7615] [BB-4846] feat: Add discussion_enabled for Unit [BD-38][TNL-7615] [BB-4846] feat: Add discussion_enabled for Unit Oct 7, 2021
@openedx-webhooks openedx-webhooks added blended PR is managed through 2U's blended developmnt program needs triage and removed open-source-contribution PR author is not from Axim or 2U awaiting prioritization labels Oct 7, 2021
@farhaanbukhsh
Copy link
Member Author

@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 😄

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
scope=Scope.content,
scope=Scope.settings,

Copy link
Contributor

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.

Comment on lines 158 to 160
Copy link
Contributor

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?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

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.

Copy link
Contributor

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.

Copy link
Contributor

@ormsbee ormsbee Oct 20, 2021

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

Copy link
Contributor

Choose a reason for hiding this comment

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

FYI @edx/perf-interest

Copy link
Contributor

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.

Copy link
Member Author

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.

@farhaanbukhsh
Copy link
Member Author

jenkins run all

@farhaanbukhsh farhaanbukhsh force-pushed the farhaan/bb-4846-add-discussion-enabled-flag branch 2 times, most recently from 911a805 to 0a0867d Compare October 25, 2021 14:10
@farhaanbukhsh
Copy link
Member Author

@awaisdar001 This is ready for review :)

Copy link
Contributor

@xitij2000 xitij2000 left a 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

Copy link
Contributor

@awaisdar001 awaisdar001 left a 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.

Copy link
Contributor

@saadyousafarbi saadyousafarbi left a 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!

Copy link
Contributor

@awaisdar001 awaisdar001 left a 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.

@awaisdar001
Copy link
Contributor

fyi @ormsbee if you would like another look at the PR.

@farhaanbukhsh farhaanbukhsh force-pushed the farhaan/bb-4846-add-discussion-enabled-flag branch from 0b0cd72 to 8ea281a Compare November 3, 2021 04:09
@awaisdar001
Copy link
Contributor

@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>
@farhaanbukhsh farhaanbukhsh force-pushed the farhaan/bb-4846-add-discussion-enabled-flag branch from 6bfb236 to f1ce013 Compare November 3, 2021 12:09
@edx-status-bot
Copy link

Your PR has finished running tests. There were no failures.

@farhaanbukhsh
Copy link
Member Author

@farhaanbukhsh can you rebase and squash the commits?

@awaisdar001 done :)

@xitij2000
Copy link
Contributor

@awaisdar001 Is this good to merge?

@awaisdar001
Copy link
Contributor

Yes - Merged!!

@awaisdar001 awaisdar001 merged commit cfe75e9 into openedx:master Nov 8, 2021
@openedx-webhooks
Copy link

@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-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production.

@farhaanbukhsh farhaanbukhsh deleted the farhaan/bb-4846-add-discussion-enabled-flag branch November 8, 2021 12:55
@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the production environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blended PR is managed through 2U's blended developmnt program merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.