diff --git a/app/Member/Member.php b/app/Member/Member.php index 61862186..565e168d 100644 --- a/app/Member/Member.php +++ b/app/Member/Member.php @@ -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) { diff --git a/tests/Feature/Member/PreventionTest.php b/tests/Feature/Member/PreventionTest.php index 2a437735..006b0b52 100644 --- a/tests/Feature/Member/PreventionTest.php +++ b/tests/Feature/Member/PreventionTest.php @@ -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], + ]; } /**