Skip to content

Commit

Permalink
Fix monthly price rounding for yearly subscriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
ellite committed Nov 25, 2023
1 parent 6e5bbc4 commit 1aaf043
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
4 changes: 2 additions & 2 deletions includes/list_subscriptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
10 changes: 3 additions & 7 deletions stats.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down

0 comments on commit 1aaf043

Please sign in to comment.