diff --git a/src/lib/components/CourseLandingPage/components/PricingSection.svelte b/src/lib/components/CourseLandingPage/components/PricingSection.svelte index 0061664f..8da9e409 100644 --- a/src/lib/components/CourseLandingPage/components/PricingSection.svelte +++ b/src/lib/components/CourseLandingPage/components/PricingSection.svelte @@ -9,7 +9,7 @@ export let courseData: Course = { id: '', title: '', - description: '', + description: '' }; let calculatedCost = 0; @@ -18,7 +18,9 @@ function calcDisc(percent: number, cost: number) { if (!percent) return cost; - return Math.round((percent / 100) * cost) || cost; + const discountAmount = (percent / 100) * cost; + const discountedPrice = cost - discountAmount; + return Math.round(discountedPrice); } function addToCart() {} @@ -36,9 +38,7 @@ -