mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
🐛 Fixed incorrect mrr delta calculation
refs https://github.com/TryGhost/Team/issues/595 For a canceled subscription, the desired MRR delta is to reduce by negative of original amount, but our logic was incorrectly reducing it by double which led to big gap between real MRR and one shown on Dashboard. - Fixes calculation for MRR change for canceled subscriptions
This commit is contained in:
parent
d5c893ca5b
commit
d4488b5e59
1 changed files with 5 additions and 3 deletions
|
@ -300,14 +300,16 @@ module.exports = class MemberRepository {
|
|||
if (status === 'incomplete_expired') {
|
||||
return 0;
|
||||
}
|
||||
const modifier = status === 'canceled' ? -1 : 1;
|
||||
if (status === 'canceled') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (interval === 'year') {
|
||||
return modifier * Math.floor(amount / 12);
|
||||
return Math.floor(amount / 12);
|
||||
}
|
||||
|
||||
if (interval === 'month') {
|
||||
return modifier * amount;
|
||||
return amount;
|
||||
}
|
||||
}
|
||||
if (model) {
|
||||
|
|
Loading…
Add table
Reference in a new issue