Fix prevention moreps
continuous-integration/drone/push Build is failing Details

This commit is contained in:
philipp lang 2024-07-25 11:13:40 +02:00
parent d64ea85be6
commit c95658ae65
2 changed files with 8 additions and 1 deletions

View File

@ -360,8 +360,10 @@ class Member extends Model implements Geolocatable
}
if ($this->more_ps_at === null) {
if ($this->ps_at === null || $this->ps_at->diffInYears($date) >= 5) {
if ($this->ps_at === null) {
$preventions[] = Prevention::PS;
} else if ($this->ps_at->diffInYears($date) >= 5) {
$preventions[] = Prevention::MOREPS;
}
} else {
if ($this->more_ps_at === null || $this->more_ps_at->diffInYears($date) >= 5) {

View File

@ -154,6 +154,11 @@ class PreventionTest extends TestCase
'attrs' => ['has_vk' => false, 'efz' => now(), 'ps_at' => now()],
'preventions' => [Prevention::VK],
];
yield [
'attrs' => ['has_vk' => true, 'efz' => now(), 'ps_at' => now()->subYears(7)],
'preventions' => [Prevention::MOREPS],
];
}
/**