OBPIH-7341 Fix assigning users when product quantity is changed to 0 during counting, and disable the Assign button if nothing is selected#5426
Conversation
…orkflow clears 'date counted, 'user counted' fields, doesn't show 'user recounted' and inventory updated info bar
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #5426 +/- ##
============================================
- Coverage 8.38% 8.34% -0.04%
+ Complexity 1040 1032 -8
============================================
Files 674 674
Lines 44494 44494
Branches 10711 10711
============================================
- Hits 3732 3715 -17
- Misses 40192 40211 +19
+ Partials 570 568 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| })); | ||
| })) | ||
| // we only want to update items that have an assignee | ||
| .filter(item => item.assignee); |
There was a problem hiding this comment.
The issue here was that if we changed the product quantity to 0 before saving, the countIndex 1 would not be created. As a result, in this line:
return cycleCountItems.map((item) => ({
id: item.id,
recount: true,
assignee: dataToAssign?.[cycleCount.maxCountIndex]?.assignee,
}))
for the cycle count with quantity product the maxCountIndex was 0, while dataToAssign had an entry only at index 1, which caused the assignee to be null and led to further issues. Therefore, if the assignee is null, there's no point in calling updateCycleCountItemsBatch for it. In that case, the behavior will be the same as when assigning the assignee via the "To Count" or "To Resolve" tab, and everything will work as expected.
There was a problem hiding this comment.
This feels weird to me. User might now know which items were and which were not sent to save. Why do we actually want to update items that have the assignee only? What's the context? Isn't assignee supposed to be filled automatically if you don't set it?
I just want to avoid another duct tape on frontend to make something work.
There was a problem hiding this comment.
So here's the thing: we had an issue where, after finishing a count with product quantity 0, setting an assignee for the resolve step caused an error. That's not true that we don't save the assignee, it's just saved in the verificationCount so everything is saved in this fuction:
const response = await cycleCountApi.updateCycleCountRequests(
currentLocation?.id,
{
commands,
},
);
and if the product quantity is later changed (e.g. to 2), the assignee will appear in the resolve workflow. I showed Manon how it works now, and she's okay with it
✨ Description of Change
Link to GitHub issue or Jira ticket:
Description:
📷 Screenshots & Recordings (optional)