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

fix percentage issue #19345

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft

fix percentage issue #19345

wants to merge 2 commits into from

Conversation

Jali-Khusi
Copy link
Contributor

@Jali-Khusi Jali-Khusi commented Oct 7, 2024

@Jali-Khusi Jali-Khusi requested a review from a team as a code owner October 7, 2024 11:54
@github-actions github-actions bot marked this pull request as draft October 7, 2024 11:54
const discountAmount = (basePrice * discountPercentage) / 100;
return basePrice - discountAmount;
if (
basePrice !== undefined &&

Choose a reason for hiding this comment

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

Baseprice you are already doing a null check when the function is called do you thing undefined is needed?

@@ -52,11 +52,18 @@ export class CpqQuoteDiscountComponent implements OnInit, OnDestroy {
}
getDiscountedPrice(
basePrice: number | undefined,
Copy link

@vigneshkrish8691 vigneshkrish8691 Oct 9, 2024

Choose a reason for hiding this comment

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

Should the price be of type number, or can it be of any other type?

@@ -45,4 +45,24 @@ export class CpqQuoteOfferComponent implements OnInit, OnDestroy {
this.subscription.unsubscribe();
}
}
getDiscountPercentage(

Choose a reason for hiding this comment

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

Why are there two identical functions in both the cpq-quote-component and the offer-component? What is the difference between them? Why cant we make use of the same?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the cpq-offer-component, the getDiscountPercentage function calculates the discount percentage, while in the cpq-quote-component, the getDiscountedPrice function calculates the discount on per-item basis.

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.

2 participants