Skip to content

OBPIH-7178 Batch endpoint for insert/update cycle count items#5233

Merged
awalkowiak merged 4 commits intodevelopfrom
OBPIH-7178
May 12, 2025
Merged

OBPIH-7178 Batch endpoint for insert/update cycle count items#5233
awalkowiak merged 4 commits intodevelopfrom
OBPIH-7178

Conversation

@kchelstowski
Copy link
Collaborator

✨ Description of Change

Link to GitHub issue or Jira ticket:

Description:


📷 Screenshots & Recordings (optional)

@kchelstowski kchelstowski self-assigned this Apr 24, 2025
@kchelstowski kchelstowski marked this pull request as draft April 24, 2025 20:38
@github-actions github-actions bot added domain: frontend Changes or discussions relating to the frontend UI domain: backend Changes or discussions relating to the backend server labels Apr 24, 2025
@kchelstowski kchelstowski added status: work in progress For issues or pull requests that are in progress but not yet completed warn: do not merge Marks a pull request that is not yet ready to be merged and removed domain: frontend Changes or discussions relating to the frontend UI domain: backend Changes or discussions relating to the backend server labels Apr 24, 2025
import {
CYCLE_COUNT, CYCLE_COUNT_ITEM,
CYCLE_COUNT_ITEMS,
CYCLE_COUNT_ITEMS, CYCLE_COUNT_ITEMS_BATCH,
Copy link
Member

Choose a reason for hiding this comment

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

should be on new line to match everything else


def beforeValidate() {
String cycleCountItemId = RequestContextHolder.getRequestAttributes().params?.cycleCountItemId
String cycleCountItemId = RequestContextHolder.getRequestAttributes().params?.cycleCountItemId ?: id
Copy link
Member

Choose a reason for hiding this comment

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

just describing this for myself because I was confused initially.

So if the cc item id is in the URI, use that, else assume it's in the request payload (and if its in both, use the one in the URI). And I'm assuming we support both cases because we still have the non-batched API, which puts it in the URI.

@github-actions github-actions bot added domain: frontend Changes or discussions relating to the frontend UI domain: backend Changes or discussions relating to the backend server labels May 9, 2025
@kchelstowski kchelstowski marked this pull request as ready for review May 9, 2025 14:47
// Nested path in colum names contains "_" instead of "."
const nestedPath = columnId.replaceAll('_', '.');
// Update data for: cycleCount (table) -> cycleCountItem (row) -> column (nestedPath)
const valueChanged = _.get(tableData.current, `[${tableIndex}].cycleCountItems[${rowIndex}].${nestedPath}`) !== value;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

there was another bug with the console.log not displaying the live data (ref: #5215 (comment))
it was difficult to determine what the issue is, but it turned out that updateData method is called a lot of times after each rerender, not only when we actually update the data, so it always set the updated flag to true even if something a while ago set it to false (markAllItemsAsNotUpdated method).
So this valueChanged flag is needed to determine if a value really changed and only then update the updated flag to true.

@kchelstowski kchelstowski removed status: work in progress For issues or pull requests that are in progress but not yet completed warn: do not merge Marks a pull request that is not yet ready to be merged labels May 9, 2025
@codecov
Copy link

codecov bot commented May 9, 2025

Codecov Report

❌ Patch coverage is 7.89474% with 35 lines in your changes missing coverage. Please review.
✅ Project coverage is 8.27%. Comparing base (d420399) to head (201a0be).
⚠️ Report is 142 commits behind head on develop.

Files with missing lines Patch % Lines
...g/pih/warehouse/inventory/CycleCountService.groovy 0.00% 12 Missing ⚠️
...g/pih/warehouse/api/CycleCountApiController.groovy 0.00% 8 Missing ⚠️
...ehouse/inventory/CycleCountItemBatchCommand.groovy 0.00% 7 Missing ⚠️
.../inventory/CycleCountUpdateItemBatchCommand.groovy 0.00% 7 Missing ⚠️
...house/inventory/CycleCountUpdateItemCommand.groovy 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             develop   #5233      +/-   ##
============================================
- Coverage       8.27%   8.27%   -0.01%     
  Complexity       980     980              
============================================
  Files            638     640       +2     
  Lines          43251   43288      +37     
  Branches       10515   10521       +6     
============================================
+ Hits            3580    3583       +3     
- Misses         39120   39154      +34     
  Partials         551     551              

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

@awalkowiak awalkowiak merged commit 4127d11 into develop May 12, 2025
9 checks passed
@awalkowiak awalkowiak deleted the OBPIH-7178 branch May 12, 2025 08:51
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 domain: frontend Changes or discussions relating to the frontend UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants