-
Notifications
You must be signed in to change notification settings - Fork 22
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
#363 remove discounted prices from syncing #382
Conversation
Codecov Report
@@ Coverage Diff @@
## master #382 +/- ##
============================================
- Coverage 93.37% 93.33% -0.05%
- Complexity 235 239 +4
============================================
Files 24 24
Lines 755 780 +25
Branches 34 36 +2
============================================
+ Hits 705 728 +23
Misses 37 37
- Partials 13 15 +2
Continue to review full report at Codecov.
|
src/integration-test/java/com/commercetools/project/sync/ProductSyncWithDiscountedPrice.java
Outdated
Show resolved
Hide resolved
@Nullable final ZonedDateTime validFrom, | ||
@Nullable final ZonedDateTime validUntil, | ||
@Nullable final String productDiscountReferenceId) { | ||
DiscountedPrice discounted = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also change this line to ternary.
DiscountedPrice discounted = (productDiscountReferenceId != null) ?
DiscountedPrice.of(TEN_EUR, Reference.of("product-discount", productDiscountReferenceId)) : null;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could, but I'm not sure if it's better. So I'll leave it as it is.
src/integration-test/java/com/commercetools/project/sync/ProductSyncWithDiscountedPrice.java
Outdated
Show resolved
Hide resolved
src/integration-test/java/com/commercetools/project/sync/util/IntegrationTestUtils.java
Outdated
Show resolved
Hide resolved
src/integration-test/java/com/commercetools/project/sync/util/IntegrationTestUtils.java
Outdated
Show resolved
Hide resolved
.stream() | ||
.map(this::createProductVariantDraftWithoutDiscounted) | ||
.collect(Collectors.toList()); | ||
ProductVariantDraft masterVariant = productDraft.getMasterVariant(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be better like this:
final ProductVariantDraft masterVariant = productDraft.getMasterVariant();
final ProductVariantDraft masterVariantDraft =
(masterVariant != null) ? createProductVariantDraftWithoutDiscounted(masterVariant) : null;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if it's better. Thus I'll leave the code as it is.
Fixes: #363
Boy-scout change: https://github.com/commercetools/commercetools-project-sync/pull/382/files#diff-359623d8a3c1bf6b3cec48920adb3a99c806104ca1e27198442c67e21d6a470f