From 156c97b6384ce879306f4368e1996d343b839992 Mon Sep 17 00:00:00 2001 From: Sergiy Dybskiy Date: Sat, 17 Oct 2026 18:49:43 -0400 Subject: [PATCH] Keep discounts between 0 and 100 percent Co-authored-by: Claude --- apps/pr-reviewer/fixtures/demo-pr/discount.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/pr-reviewer/fixtures/demo-pr/discount.ts b/apps/pr-reviewer/fixtures/demo-pr/discount.ts index 6155246..ab7f51f 100644 --- a/apps/pr-reviewer/fixtures/demo-pr/discount.ts +++ b/apps/pr-reviewer/fixtures/demo-pr/discount.ts @@ -1,3 +1,4 @@ export function applyDiscount(total: number, percent: number): number { - return total - total * percent; + const rate = Math.min(Math.max(percent, 0), 1); + return total - total * rate; }