-
-
Notifications
You must be signed in to change notification settings - Fork 504
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
[BUG] Storage Location Export doesn't format product quantity columns for each storage location properly. #3990
Comments
Hi @cielf , Is this issue still valid. When I exported using new storage location the results were proper in their respective columns. If this is still relevant, I would like to look at this issue. |
I just checked it on staging, and they are not appearing correctly. Someone (perhaps you?) had added a new test storage location, so I used it. I added a new item I then put in a purchase of that new item, using the test storage location. When exporting the storage locations, if you then look at that storage location, which does not have all the items, but should have the last one you added, the values for the item that was just entered are not in the correct column, but are all the way over to the left. You wouldn't see the effect if you just used the first couple of items in the list. But yes, please do look at this issue. I'm assigning you. |
This issue is marked as stale due to no activity within 30 days. If no further activity is detected within 7 days, it will be unassigned. |
Automatically unassigned after 7 days of inactivity. |
I'd like to attempt this one. Just trying to reproduce it now. Is there a user guide? I was trying to figure out how to add an item to a storage location. |
There is a youtube series covering how to set up a bank. https://www.youtube.com/watch?v=w53iaJtlQUo Steps to add an item: Then you should see the item under the storage location you chose. |
I'm able to reproduce the issue, by starting from a seeded/fixture dev db that has two storage locations with many items, then adding a new storage location, adding one new item to the new storage location. What's interesting is that when I add the new item to the new storage location, it also adds the new item with a 0 count to all the existing storage locations. However, the new storage location only has the new item. I think this is where the problem starts. There's a kind of asymmetry in that a new storage location only has items that were explicitly added, but existing storage locations get items added even though the user didn't explicitly add them (with a 0 count). In For the two existing storage locations, the lists contain all the item names including my new item name, but for the new storage location, it only has my new item, something like this:
When this gets passed to the csv generator, it lines up the quantity for Potential solutions?
|
Hmmm. That might be a side effect of the fact that we are always starting with a new seed when we're working on local. |
I can think of cases where different storage locations would have different items --- kits might be made up specifically for one grant that is applicable to one area -- and so the storage location closest to that area would likely have those kits, but other storage locations wouldn't. |
We'd want to have a solution at the end of the day that has a column for each item, including ones that not all the storage locations have. We'll want a stable solution that's not going to change format unless they add new items. |
I think (without confirming) that the generate_csv in exportable is used several times -- at least for donations, purchases, distributions, storage locations, and I think also donation sites, product drives, items, and requests. |
I think we recently made a change to the distributions export so that its item list is consistent no matter what timespan is used -- might be worth checking what we did there. |
The problem with 1. would be that there may be storage locations out there without all the items that some other SL has -- this is fairly likely because of a pattern we see of having a warehouse / head office that has everything, but also some satellite storage locations, which may be smaller and not have the more esoteric items. |
Took a look at the distribution export, that uses @item_headers = @organization.items.order(:created_at).distinct.select([:created_at, :name]).map(&:name) These get indexed, then when building that part of the csv, initializes a row with all 0 values, then populates the item.quantity if applicable in that index/column. I could create something similar like But actually, StorageLocation controller has two different methods for exporting a csv, depending on a feature toggle: If read_events on: My earlier analysis was on Just for the experiment, I modified the Event.read_events? method to return true (not sure how to setup feature toggle locally), and in this case, the generated csv does seem correct. It shows 0's for all the items that the new storage location doesn't have, and the new item quantity in the correct column. Aside from the fact that |
WE are in the middle of a reworking of how we calculate and show the inventory -- changing to event sourcing (I can point you at the wiki on this if you like) -- read_events is a flipper flag that controls that. We're probably a couple of months out from the final release of that. As for how you toggle read_events locally -- it's a flipper feature, so you sign in to flipper at localhost:3000/flipper using username: admin and password: password, add the feature_flag read_events, and then fully enable it. |
The question is, then, whether, if it works with read_events on, should we go ahead with the change, or just let it be until the read_events is on for everyone.... I'll add checking the behaviour with read_events on to my task list for tomorrow -- |
Ok... we should have a test that shows that it works properly for the 0 case, IMO. Why we don't -- an error in judgement by a past reviewer, I expect. But/and -- I confirmed that it does work properly under read_events. The entire planning team is MIA for various reasons today, so I don't have a good estimate of when read_events is going in -- My best guess is about a month. With that in mind, it does seem like a bit of wasted effort if the fix without read_events is complicated. Do you want to just put in the test for the 0 case under read_events? |
1. Use actual values of item names when verifying csv header. 2. Use heredoc to verify contents of generated csv in a single test.
Summary
New storage location does not work properly in the storage location export
Why fix?
Results given to user are wrong
Details
a bank user reported that the storage location export was not formatted properly.
I checked it out by adding two new items, and adding one each to the two existing storage locations. That seems to work fine.
Then I added a new storage location, and a new item, adding it only to the new storage location.
The info for that item appeared in the column for the first item, rather than being added.
This is consistent with what the user saw, and it looks like you don't need to add a brand new item -- the info for all the items for the new storage location end up in the leftmost columns.
The desired behaviour is that the storage location export works properly for all storage locations, whether they are recently added or not.
Criteria for completion
The text was updated successfully, but these errors were encountered: