OBPIH-7195 fix5: merge rows with same product, bin, lot into same transaction entry#5332
OBPIH-7195 fix5: merge rows with same product, bin, lot into same transaction entry#5332awalkowiak merged 1 commit intodevelopfrom
Conversation
| product: row.product, | ||
| binLocation: row.binLocation, | ||
| inventoryItem: row.inventoryItem, | ||
| comments: rowsForKey.comments.join(", "), |
There was a problem hiding this comment.
Note here that import rows with the same key will have their comments merged in the resulting adjustment transaction entry. This behaviour would be good to confirm with Manon / Kasia to see if that's acceptable.
|
whoever picks this up, please test the code out. I didn't have time to test it myself thoroughly before leaving |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #5332 +/- ##
============================================
- Coverage 8.41% 8.38% -0.04%
+ Complexity 1019 1016 -3
============================================
Files 656 656
Lines 43829 43831 +2
Branches 10612 10613 +1
============================================
- Hits 3689 3676 -13
- Misses 39568 39587 +19
+ Partials 572 568 -4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| continue | ||
| } | ||
| // We know we have at least one row for the key at this point so this is safe to do. | ||
| InventoryImportDataRow row = rowsForKey[0] |
There was a problem hiding this comment.
What if we are importing with different products, will it still work?
There was a problem hiding this comment.
Yes. inventoryImportData.rows is a Map<String, List<InventoryImportDataRow>> keyed on [product code + bin location name + lot number] so every value in the rowsForKey List have the same product.
(PS I'm only replying because I'm at the train station and bored. I'm going back on vacation now 😅)
✨ Description of Change
Link to GitHub issue or Jira ticket: https://pihemr.atlassian.net/browse/OBPIH-7195
Description: This is an alternate solution to the original implementation. I originally was trying to keep it so that if we had multiple rows in the import with the same [product, lot, bin] key, they'd stay as separate transaction entries of the adjustment transaction. But this has led to edge case scenario weirdness which caused multiple re-opens of the ticket.
Kasia's video hilights the current state of things well: https://jam.dev/c/6369f1cb-9376-48b0-8459-3fa50139668b
Because of all these edge cases, I opted for a (hopefully) more straight forward solution where we simply merge all rows with the same key together and create a single adjustment transaction entry from them (if one is required). I don't know why I didn't think of doing it this way from the beginning but 🤷
This code is currently untested so it'd be great if someone can pick this up while I'm gone.