Skip to content

Wallos: Open-source, self-hostable personal subscription tracker. Visualize your recurring expenses, manage your budget, and save money.

Fix monthly price rounding for yearly subscriptions

ellite1aaf043d8941
diff --git a/includes/list_subscriptions.php b/includes/list_subscriptions.php
index 697a262..feaf6d6 100644
--- a/includes/list_subscriptions.php
+++ b/includes/list_subscriptions.php
@@ -32,8 +32,8 @@
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 0bca08d..68047ba 100644
--- a/stats.php
+++ b/stats.php
@@ -16,13 +16,9 @@
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;
}
}