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

LUI-161, Unable to edit the created alert in Users section #122

Merged
merged 2 commits into from
Jul 20, 2020
Merged

LUI-161, Unable to edit the created alert in Users section #122

merged 2 commits into from
Jul 20, 2020

Conversation

Am-Coder
Copy link
Member

@Am-Coder Am-Coder commented Jul 6, 2020

Description of what I changed

The already scheduled users need not be scheduled again. So, had to remove the already scheduled users.

Issue I worked On
see https://issues.openmrs.org/browse/LUI-161

@@ -119,6 +119,8 @@ protected ModelAndView processFormSubmission(HttpServletRequest request, HttpSer
if (!userIds.contains(userId)) {
recipientsToRemove.add(recipient);
}
//To remove the users that have already been scheduled
userIds.remove(userId);
Copy link
Contributor

Choose a reason for hiding this comment

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

@Am-Coder done on this,have you tested this with a running instance of openmrs?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup, I have verified the working using OpenMRS SDK on both distribution and platform server. Also tested this on OpenMRS-core separately by making use of the generated omod of legacy-ui module.

Copy link
Member

Choose a reason for hiding this comment

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

I find your addition confusing because it is under a block for removing all recipients not in the userIds list. Which has nothing to do with clearing the userIds list.

Copy link
Member Author

Choose a reason for hiding this comment

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

userIds hold the id's of users that will be called for scheduling as shown here . In this loop where I have added the change, all the recipients of alert are the recipients that have already been scheduled. These id's need to be removed from userIds , otherwise you will try to persist the duplicate and hence raise an exception.

That is why I added the change in the loop.

Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't it be in some sort of else clause?

Copy link
Member Author

Choose a reason for hiding this comment

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

Else clause will be more appropriate. Made the changes.

Copy link
Member Author

Choose a reason for hiding this comment

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

@dkayiwa , are some more changes needed for this PR ?

@dkayiwa dkayiwa merged commit b7f9329 into openmrs:master Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants