Skip to content

Conversation

capernix
Copy link
Contributor

@capernix capernix commented Apr 6, 2025

Description of what I changed

  • Implemented order sorting logic in OrderResource1_8 using a Comparator that sorts by dateCreated in descending order
  • Added comprehensive unit test shouldSortOrdersByDateInDescendingOrder() to verify the sorting functionality
  • Added the required imports in the test and logic file

Issue I worked on

https://openmrs.atlassian.net/browse/RESTWS-945

Checklist: I completed these to help reviewers :)

  • [ x] My IDE is configured to follow the code style of this project.

  • [ x] I have added tests to cover my changes. (If you refactored
    existing code that was well tested you do not have to add tests)

  • [x ] I ran mvn clean package right before creating this pull request and
    added all formatting changes to my commit.

  • [x ] All new and existing tests passed.

  • [ x] My pull request is based on the latest changes of the master branch.

orders.sort(new Comparator<Order>() {
@Override
public int compare(Order o1, Order o2) {
return o2.getDateCreated().compareTo(o1.getDateCreated());
Copy link

Choose a reason for hiding this comment

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

Should we consider dateActivated or dateCreated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes now that you mention it I think it is better as well, but in the time I interacted with the issue I didn't see the difference, can you give me examples why is it better?

Copy link

Choose a reason for hiding this comment

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

Yes now that you mention it I think it is better as well, but in the time I interacted with the issue I didn't see the difference, can you give me examples why is it better?

There will be differences especially where we do RDE for orders

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay I will change the code to sort by dateActivated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants