Fix: Dont remember past events
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
c990ce3171
commit
9fc8548504
|
@ -17,7 +17,12 @@ class PreventionRememberAction
|
|||
|
||||
public function handle(): void
|
||||
{
|
||||
$query = Participant::whereHas('form', fn ($form) => $form->where('needs_prevention', true))
|
||||
$query = Participant::whereHas(
|
||||
'form',
|
||||
fn ($form) => $form
|
||||
->where('needs_prevention', true)
|
||||
->where('from', '>=', now())
|
||||
)
|
||||
->where(
|
||||
fn ($q) => $q
|
||||
->where('last_remembered_at', '<=', now()->subWeeks(2))
|
||||
|
|
|
@ -39,6 +39,18 @@ class PreventionTest extends TestCase
|
|||
$this->assertEquals(now()->format('Y-m-d'), $participant->fresh()->last_remembered_at->format('Y-m-d'));
|
||||
}
|
||||
|
||||
public function testItDoesntRememberPastEvents(): void
|
||||
{
|
||||
Mail::fake();
|
||||
$form = $this->createForm();
|
||||
$participant = $this->createParticipant($form);
|
||||
$form->update(['from' => now()->subDay()]);
|
||||
|
||||
PreventionRememberAction::run();
|
||||
|
||||
$this->assertNull($participant->fresh()->last_remembered_at);
|
||||
}
|
||||
|
||||
public function testItDoesntRememberWhenConditionDoesntMatch(): void
|
||||
{
|
||||
Mail::fake();
|
||||
|
|
Loading…
Reference in New Issue