Skip to content

Commit

Permalink
Fix the check if contribution is payed on quarterly payments
Browse files Browse the repository at this point in the history
The check was broken. In most cases, the contribution should
be considered "payed" when at least one payment happened
during the last 3 months when the subscription type is
quarterly.
  • Loading branch information
rrooij committed Jul 27, 2024
1 parent 794a192 commit c521b4e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Entity/Member.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@ public function isContributionCompleted(DateTime $when) {
$payments = $this->contributionPayments->filter(fn($payment) => $payment->getPeriodYear() == $year && $payment->getPeriodMonthStart() == $month);
break;
case self::PERIOD_QUARTERLY:
$quarter = ceil($month / 3);
$payments = $this->contributionPayments->filter(fn($payment) => $payment->getPeriodYear() == $year && $payment->getPeriodMonthStart() <= $month && $payment->getPeriodMonthEnd() >= $month);
$when->modify('-3 months');
$payments = $this->contributionPayments->filter(fn($payment) => $payment->getPaymentTime() >= $when);
break;
case self::PERIOD_ANNUALLY:
$payments = $this->contributionPayments->filter(fn($payment) => $payment->getPeriodYear() == $year);
Expand Down

0 comments on commit c521b4e

Please sign in to comment.