human-essentials icon indicating copy to clipboard operation
human-essentials copied to clipboard

4219 Fixed Order of items in inventory adjustment

Open iamronakgupta opened this issue 1 year ago • 8 comments

Resolves #4219

iamronakgupta avatar May 24 '24 15:05 iamronakgupta

I believe the appropriate place to make the change for the order of items for the inventory adjustments is the adjustments controller, not the storage location controller.

There is code there that appears to be alphabetizing the items -- but I believe it is not alphabetizing them by item name, so it ends up being in the order they were added.

Please also provide tests for your changes.

@cielf Thank you for the review.

After checking from logs, I find out that when we changes storage location from drop down, there is an ajax call happens GET /storage_locations/3/inventory.json?include_omitted_items=true which calls inventory action from storage_locations_controller and that's where items changes their order. So I think the issue is in storage_locations_controller and specifically in inventory action. Whats your thought?

iamronakgupta avatar May 24 '24 18:05 iamronakgupta

Reference

@dorner yes I am working on this.

Just to confirm, I am working on storage_location_requests_spec here

Am I working at right place?

iamronakgupta avatar May 24 '24 20:05 iamronakgupta

@iamronakgupta I fear that you are "barking up the wrong tree" -- working to solve the problem in the wrong place.

For clarity, here is the result when I manually tested it just now. You can see that the items dropdown in the Inventory Adjustments screen is not showing the items in alphabetical order.

Screenshot 2024-05-25 at 8 41 22 AM

The changes you have made so far would affect a different screen -- the storage locations view.

cielf avatar May 25 '24 12:05 cielf

@iamronakgupta I fear that you are "barking up the wrong tree" -- working to solve the problem in the wrong place.

For clarity, here is the result when I manually tested it just now. You can see that the items dropdown in the Inventory Adjustments screen is not showing the items in alphabetical order.

Screenshot 2024-05-25 at 8 41 22 AM The changes you have made so far would affect a different screen -- the storage locations view.

@cielf I think this is working because order and sort_by method puts words with lowercase at the bottom and uppercase at top

iamronakgupta avatar May 26 '24 06:05 iamronakgupta

Yup. Looks like that is what it is doing, And it's what it was doing.

IMO, it should be a case insensitive sort because humans sort case insensitively - but that would currently make it inconsistent with the rest of the system.

cielf avatar May 26 '24 12:05 cielf

Yup. Looks like that is what it is doing, And it's what it was doing.

IMO, it should be a case insensitive sort because humans sort case insensitively - but that would currently make it inconsistent with the rest of the system.

@cielf So, how should I implement it? with case sensitive or insensitive?

iamronakgupta avatar May 26 '24 19:05 iamronakgupta

With case sensitive. We'd want to make all the sorts case insensitive at the same time.

cielf avatar May 27 '24 11:05 cielf

@iamronakgupta this has been sitting for a while - are you planning on picking it back up?

dorner avatar Aug 16 '24 19:08 dorner

Looks like the issue (#4219) that this PR is trying to fix has been closed, so this PR is no longer needed. @iamronakgupta Feel free to reopen if I am mistaken.

(Doing some cleanup on old issues/PRs.)

coalest avatar Jan 08 '25 11:01 coalest