Skip to content

OBPIH-7341 Fix assigning users when product quantity is changed to 0 during counting, and disable the Assign button if nothing is selected#5426

Merged
awalkowiak merged 3 commits intodevelopfrom
OBPIH-7341
Jul 31, 2025
Merged

OBPIH-7341 Fix assigning users when product quantity is changed to 0 during counting, and disable the Assign button if nothing is selected#5426
awalkowiak merged 3 commits intodevelopfrom
OBPIH-7341

Conversation

@SebastianLib
Copy link
Copy Markdown
Collaborator

✨ Description of Change

Link to GitHub issue or Jira ticket:

Description:


📷 Screenshots & Recordings (optional)

@github-actions github-actions bot added the domain: frontend Changes or discussions relating to the frontend UI label Jul 30, 2025
@codecov
Copy link
Copy Markdown

codecov bot commented Jul 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 8.34%. Comparing base (9f13865) to head (dd5081c).
⚠️ Report is 123 commits behind head on develop.

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

}));
}))
// we only want to update items that have an assignee
.filter(item => item.assignee);
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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,
        },
      ); 
image

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

@awalkowiak awalkowiak merged commit 9ea837e into develop Jul 31, 2025
7 checks passed
@awalkowiak awalkowiak deleted the OBPIH-7341 branch July 31, 2025 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: frontend Changes or discussions relating to the frontend UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants