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

#363 remove discounted prices from syncing #382

Merged
merged 11 commits into from
Jun 9, 2022

Conversation

lojzatran
Copy link
Contributor

@lojzatran lojzatran commented Jun 3, 2022

@codecov-commenter
Copy link

codecov-commenter commented Jun 4, 2022

Codecov Report

Merging #382 (2358afb) into master (323a8ac) will decrease coverage by 0.04%.
The diff coverage is 92.30%.

@@             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     
Impacted Files Coverage Δ
...mercetools/project/sync/product/ProductSyncer.java 87.50% <92.30%> (+2.88%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c872bb3...2358afb. Read the comment docs.

@lojzatran lojzatran changed the title #363 remove discounted pricesˆ from syncing #363 remove discounted prices from syncing Jun 4, 2022
@lojzatran lojzatran marked this pull request as ready for review June 4, 2022 08:00
@praveenkumarct praveenkumarct self-requested a review June 8, 2022 10:42
@Nullable final ZonedDateTime validFrom,
@Nullable final ZonedDateTime validUntil,
@Nullable final String productDiscountReferenceId) {
DiscountedPrice discounted = null;
Copy link
Contributor

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;

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 could, but I'm not sure if it's better. So I'll leave it as it is.

.stream()
.map(this::createProductVariantDraftWithoutDiscounted)
.collect(Collectors.toList());
ProductVariantDraft masterVariant = productDraft.getMasterVariant();
Copy link
Contributor

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;

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'm not sure if it's better. Thus I'll leave the code as it is.

@lojzatran lojzatran merged commit 7884fe9 into master Jun 9, 2022
@lojzatran lojzatran deleted the remove_discounted_price_from_sync branch June 9, 2022 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Product Sync erroring when using product discounts
3 participants