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

fix: Bulk email recipient options #171

Conversation

Inferato
Copy link
Contributor

@Inferato Inferato commented Nov 9, 2023

Description

According to the chapter Sending Email Messages to Learners in Different Enrollment Tracks course can may more than one mode and instructor must have the ability to send the email for users in this modes.
Communication MFE had a hardcoded 2 modes for every course. Sometimes it lead to the error.
изображение

courseModes was added to courseMetadata to display real course email recipient options.

Related MR:

@openedx-webhooks
Copy link

Thanks for the pull request, @Inferato! 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:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

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.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Nov 9, 2023
@Inferato Inferato force-pushed the lytvynenko/RGOeX-26199/bulk_email_checkbox_master branch from 9cb6fa8 to 02d17ae Compare November 9, 2023 22:24
Copy link

codecov bot commented Nov 9, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (56e1781) 83.01% compared to head (59a02eb) 83.18%.
Report is 8 commits behind head on master.

❗ Current head 59a02eb differs from pull request most recent head ea5d6a2. Consider uploading reports for the commit ea5d6a2 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #171      +/-   ##
==========================================
+ Coverage   83.01%   83.18%   +0.17%     
==========================================
  Files          46       47       +1     
  Lines         683      690       +7     
  Branches      132      135       +3     
==========================================
+ Hits          567      574       +7     
  Misses        116      116              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines 60 to 62
courseModes
&& courseModes.length > 1
&& courseModes.map((courseMode) => (

Choose a reason for hiding this comment

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

I propose to move logical operations into a separate variable, this will simplify the readability of the code.

Suggested change
courseModes
&& courseModes.length > 1
&& courseModes.map((courseMode) => (
const isCourseModes = courseModes && courseModes.length > 1;
...
isCourseModes && courseModes.map((courseMode) => (

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point! I already moved it. Thx!

@@ -0,0 +1,18 @@
import { Factory } from 'rosie'; // eslint-disable-line import/no-extraneous-dependencies

const courseModeFactory = () => {

Choose a reason for hiding this comment

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

It would be a good idea to add some jsDocs documentation for this code. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK. It has already been added. Check please and add any suggestions if needed.


function renderBulkEmailForm() {
const { cohorts } = cohortFactory.build();
return (
<BulkEmailProvider>
<BulkEmailForm courseId="test" cohorts={cohorts} />
<BulkEmailForm
courseId="test"

Choose a reason for hiding this comment

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

Just a suggestion: let's come up with a more meaningful name for this identifier 💯

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you have any examples? I used the same name as in the backend.

Copy link

@PKulkoRaccoonGang PKulkoRaccoonGang Nov 16, 2023

Choose a reason for hiding this comment

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

mockCourseId or exampleCourseId
Please, If it's possible

Copy link
Contributor Author

@Inferato Inferato Nov 16, 2023

Choose a reason for hiding this comment

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

Ok, if it is necessary. This ID was here before I made the changes to the tests so I didn't check this part for correctness

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I decided to not change courseId value to save the common style of test values.

*
* @returns {Object[]} An array of course mode objects generated by different factories.
*/
import { Factory } from 'rosie'; // eslint-disable-line import/no-extraneous-dependencies

Choose a reason for hiding this comment

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

It seems to me that there is no need to write jsDocs for import.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a doc for the module, not for import

Choose a reason for hiding this comment

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

I would remove it, but I leave the decision up to you 👍

Copy link
Contributor

@arbrandes arbrandes left a comment

Choose a reason for hiding this comment

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

Approved in principle, though I have a nit with a variable name. Thanks!

Let's wait to merge this until after the backend PR merges, though.

additionalCohorts,
courseModes,
} = props;
const isCourseModes = courseModes && courseModes.length > 1;
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
const isCourseModes = courseModes && courseModes.length > 1;
const hasCourseModes = courseModes && courseModes.length > 1;

</Form.Checkbox>
{
// additional modes
isCourseModes
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
isCourseModes
hasCourseModes

@dyudyunov
Copy link
Contributor

Sorry for the delays, Taras is no longer a member of RG.
Currently, I'm gathering all the PRs he worked on. I will check their statuses and update them if necessary.

I will leave the status update comments on each PR's comments ASAP

@dyudyunov
Copy link
Contributor

Hello @arbrandes

Could you close this PR? I can't add edits to the source branch so I opened a new one where I took the source branch from here as it is and just applied your suggestions.

@mphilbrick211
Copy link

closing per the comment above.

@openedx-webhooks
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open-source-contribution PR author is not from Axim or 2U
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

6 participants