OBPIH-7195 fix3: inventory import, fix existing transaction check#5298
OBPIH-7195 fix3: inventory import, fix existing transaction check#5298awalkowiak merged 2 commits intodevelopfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #5298 +/- ##
============================================
- Coverage 8.34% 8.30% -0.04%
+ Complexity 1002 994 -8
============================================
Files 649 649
Lines 43650 43650
Branches 10579 10578 -1
============================================
- Hits 3642 3625 -17
- Misses 39446 39465 +19
+ Partials 562 560 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| * ordered by transaction date to make it easy to iterate through them chronologically. | ||
| */ | ||
| List<TransactionEntry> getTransactionEntriesBeforeDate(Location facility, List<Product> products, Date date) { | ||
| List<TransactionEntry> getTransactionEntriesBeforeDate(Location facility, Collection<Product> products, Date date) { |
There was a problem hiding this comment.
Why did you change types from Lists to Collections?
There was a problem hiding this comment.
I initially implemented this ticket differently and was using sets and didn't want to have to convert to lists because these methods are generic enough to handle any collection type. I changed my implementation to not need the change, but I kept this part because I felt being generic was friendlier (ex: line 146 in InventoryImportDataService)
✨ Description of Change
Link to GitHub issue or Jira ticket: https://pihemr.atlassian.net/browse/OBPIH-7195
Description: This is just embarassing now 🙃 The original code that checked for duplicate transactions was using the items in product availability, but those available items were from the time of the baseline transaction. If there were items in the import that didn't have any availability at the time of the baseline (ie quantity == 0) they didn't have any product availability records, and so wouldn't get checked. Now I make sure to check ALL items that were given in the input data.
📷 Screenshots & Recordings (optional)