Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sync-actions): adding support for changeAssetOrder in ProductVariants #1885

Merged
merged 2 commits into from
Sep 26, 2023

Conversation

kafis
Copy link
Contributor

@kafis kafis commented Sep 25, 2023

Summary

Adding support for changeAssetOrder in ProductVariants.

Description

The first updateAction to be generated will be the changeAssetOrder for the group assets.

Todo

  • Tests
    • Unit
    • Integration
    • Acceptance
  • Documentation
  • Type label for the PR

@kafis kafis requested review from markus-azer, leventekobor, ajimae and a team September 25, 2023 09:44
@changeset-bot
Copy link

changeset-bot bot commented Sep 25, 2023

🦋 Changeset detected

Latest commit: 0096b08

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@commercetools/sync-actions Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov
Copy link

codecov bot commented Sep 25, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (d79eb04) 94.74% compared to head (0096b08) 94.75%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1885      +/-   ##
==========================================
+ Coverage   94.74%   94.75%   +0.01%     
==========================================
  Files         147      147              
  Lines        5041     5057      +16     
  Branches     1373     1375       +2     
==========================================
+ Hits         4776     4792      +16     
  Misses        262      262              
  Partials        3        3              
Files Coverage Δ
packages/sync-actions/src/product-actions.js 96.19% <100.00%> (+0.20%) ⬆️
packages/sync-actions/src/product-types-actions.js 98.80% <100.00%> (ø)
...ackages/sync-actions/src/quote-requests-actions.js 100.00% <ø> (ø)
packages/sync-actions/src/quote-requests.js 100.00% <100.00%> (ø)
packages/sync-actions/src/quotes-actions.js 100.00% <ø> (ø)
packages/sync-actions/src/quotes.js 100.00% <100.00%> (ø)
packages/sync-actions/src/staged-quotes-actions.js 100.00% <ø> (ø)
packages/sync-actions/src/staged-quotes.js 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kafis kafis requested a review from tdeekens September 26, 2023 07:47
Copy link
Contributor

@tdeekens tdeekens left a comment

Choose a reason for hiding this comment

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

💯 looks nice. I am a bit confused by the formatting changes. Everything else feels like a nit. Take it or leave it.

packages/sync-actions/src/product-actions.js Outdated Show resolved Hide resolved
packages/sync-actions/src/product-actions.js Outdated Show resolved Hide resolved
packages/sync-actions/src/product-actions.js Outdated Show resolved Hide resolved
@@ -29,7 +26,7 @@ function createQuoteRequestsMapActions(
return function doMapActions(
diff: Object,
newObj: Object,
oldObj: Object,
oldObj: Object
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did we remove the , here? Is is some auto-formatting regression?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the "put a comma" rule only applies to objects and not function params

@@ -1,6 +1,8 @@
/* eslint-disable max-len */
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This File

@@ -1731,5 +1731,83 @@ describe('Actions', () => {
]
expect(actual).toEqual(expected)
})

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This section

Copy link
Contributor

@islam3zzat islam3zzat left a comment

Choose a reason for hiding this comment

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

Looks good 👍

Regarding the format changes, do you have the same node/yarn versions than the ones specified int the nvmrc and yarnrc?

@kafis kafis force-pushed the BMU-824/support-asset-ordering-for-product-updates branch from 9de814c to 5c6c49d Compare September 26, 2023 09:46
@kafis
Copy link
Contributor Author

kafis commented Sep 26, 2023

Looks good 👍

Regarding the format changes, do you have the same node/yarn versions than the ones specified int the nvmrc and yarnrc?

checked and it does match

Copy link
Member

@markus-azer markus-azer left a comment

Choose a reason for hiding this comment

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

Looks pretty good to me 👍
extended the test to make sure that actions are generated in order change order then other assets actions

Comment on lines +4 to +5
import intersection from 'lodash.intersection'
import without from 'lodash.without'
Copy link
Member

Choose a reason for hiding this comment

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

would avoid lodash, yep its clean but it had performance cost, there were old PR removed some lodash cause it were impacting performance, but tbh that would do the job for now 😉

oldVariant,
newVariant
)
return [...changedAssetOrderAction, ...assetActions]
Copy link
Member

Choose a reason for hiding this comment

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

that brilliant 👍

@kafis kafis merged commit d6cb274 into master Sep 26, 2023
5 checks passed
@kafis kafis deleted the BMU-824/support-asset-ordering-for-product-updates branch September 26, 2023 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants