From 1aaf043d89411da354e5ee64fee569767cfb0525 Mon Sep 17 00:00:00 2001 From: ellite Date: Sat, 25 Nov 2023 10:29:39 +0100 Subject: [PATCH] Fix monthly price rounding for yearly subscriptions --- includes/list_subscriptions.php | 4 ++-- stats.php | 10 +++------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/includes/list_subscriptions.php b/includes/list_subscriptions.php index 697a262c9..feaf6d6bb 100644 --- a/includes/list_subscriptions.php +++ b/includes/list_subscriptions.php @@ -32,8 +32,8 @@ function getPricePerMonth($cycle, $frequency, $price) { return $price * $numberOfPaymentsPerMonth; break; case 4: - $numberOfPaymentsPerMonth = (0.083 / $frequency); - return $price * $numberOfPaymentsPerMonth; + $numberOfMonths = (12 * $frequency); + return $price / $numberOfMonths; break; } } diff --git a/stats.php b/stats.php index 0bca08d5a..68047bae4 100644 --- a/stats.php +++ b/stats.php @@ -16,13 +16,9 @@ function getPricePerMonth($cycle, $frequency, $price) { return $price * $numberOfPaymentsPerMonth; break; case 4: - if ($frequency === 1) { - return $price / 12; - break; - } - $numberOfPaymentsPerMonth = (0.0833310 / $frequency); - return $price * $numberOfPaymentsPerMonth; - break; + $numberOfMonths = (12 * $frequency); + return $price / $numberOfMonths; + break; } }