OBPIH-7178 Batch endpoint for insert/update cycle count items#5233
OBPIH-7178 Batch endpoint for insert/update cycle count items#5233awalkowiak merged 4 commits intodevelopfrom
Conversation
src/js/api/services/CycleCountApi.js
Outdated
| import { | ||
| CYCLE_COUNT, CYCLE_COUNT_ITEM, | ||
| CYCLE_COUNT_ITEMS, | ||
| CYCLE_COUNT_ITEMS, CYCLE_COUNT_ITEMS_BATCH, |
There was a problem hiding this comment.
should be on new line to match everything else
|
|
||
| def beforeValidate() { | ||
| String cycleCountItemId = RequestContextHolder.getRequestAttributes().params?.cycleCountItemId | ||
| String cycleCountItemId = RequestContextHolder.getRequestAttributes().params?.cycleCountItemId ?: id |
There was a problem hiding this comment.
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.
… all the items being sent every request
| // 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; |
There was a problem hiding this comment.
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.
Codecov Report❌ Patch coverage is 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. 🚀 New features to boost your workflow:
|
✨ Description of Change
Link to GitHub issue or Jira ticket:
Description:
📷 Screenshots & Recordings (optional)