Skip to content

OBPIH-7195 fix5: merge rows with same product, bin, lot into same transaction entry#5332

Merged
awalkowiak merged 1 commit intodevelopfrom
bug/OBPIH-7195-5
Jun 18, 2025
Merged

OBPIH-7195 fix5: merge rows with same product, bin, lot into same transaction entry#5332
awalkowiak merged 1 commit intodevelopfrom
bug/OBPIH-7195-5

Conversation

@ewaterman
Copy link
Member

✨ 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.

@github-actions github-actions bot added type: bug Addresses unintended behaviours of the app domain: backend Changes or discussions relating to the backend server labels Jun 13, 2025
product: row.product,
binLocation: row.binLocation,
inventoryItem: row.inventoryItem,
comments: rowsForKey.comments.join(", "),
Copy link
Member Author

Choose a reason for hiding this comment

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

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.

@ewaterman
Copy link
Member Author

whoever picks this up, please test the code out. I didn't have time to test it myself thoroughly before leaving

@codecov
Copy link

codecov bot commented Jun 13, 2025

Codecov Report

❌ Patch coverage is 0% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 8.38%. Comparing base (1b1d300) to head (0cc982e).
⚠️ Report is 143 commits behind head on develop.

Files with missing lines Patch % Lines
...rehouse/importer/InventoryImportDataService.groovy 0.00% 11 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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]
Copy link
Collaborator

Choose a reason for hiding this comment

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

What if we are importing with different products, will it still work?

Copy link
Member Author

Choose a reason for hiding this comment

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

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 😅)

@awalkowiak awalkowiak merged commit bd10998 into develop Jun 18, 2025
8 checks passed
@awalkowiak awalkowiak deleted the bug/OBPIH-7195-5 branch June 18, 2025 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: backend Changes or discussions relating to the backend server type: bug Addresses unintended behaviours of the app

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants