Compare commits
No commits in common. "1ee04edfc97c9aeb9432ca8fb651d20363e2b30c" and "b05d4529b4b4f4b6eca816cf24919d91fb38afe5" have entirely different histories.
1ee04edfc9
...
b05d4529b4
|
@ -6,7 +6,6 @@ use App\Actions\DbMaintainAction;
|
||||||
use App\Form\Actions\PreventionRememberAction;
|
use App\Form\Actions\PreventionRememberAction;
|
||||||
use App\Initialize\InitializeMembers;
|
use App\Initialize\InitializeMembers;
|
||||||
use App\Invoice\Actions\InvoiceSendAction;
|
use App\Invoice\Actions\InvoiceSendAction;
|
||||||
use App\Prevention\Actions\YearlyRememberAction;
|
|
||||||
use Illuminate\Console\Scheduling\Schedule;
|
use Illuminate\Console\Scheduling\Schedule;
|
||||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||||
|
|
||||||
|
@ -22,7 +21,6 @@ class Kernel extends ConsoleKernel
|
||||||
InitializeMembers::class,
|
InitializeMembers::class,
|
||||||
DbMaintainAction::class,
|
DbMaintainAction::class,
|
||||||
PreventionRememberAction::class,
|
PreventionRememberAction::class,
|
||||||
YearlyRememberAction::class,
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -36,7 +34,6 @@ class Kernel extends ConsoleKernel
|
||||||
$schedule->command(InitializeMembers::class)->dailyAt('03:00');
|
$schedule->command(InitializeMembers::class)->dailyAt('03:00');
|
||||||
$schedule->command(PreventionRememberAction::class)->dailyAt('11:00');
|
$schedule->command(PreventionRememberAction::class)->dailyAt('11:00');
|
||||||
$schedule->command(InvoiceSendAction::class)->dailyAt('10:00');
|
$schedule->command(InvoiceSendAction::class)->dailyAt('10:00');
|
||||||
$schedule->command(YearlyRememberAction::class)->dailyAt('09:00');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -7,7 +7,6 @@ use App\Prevention\Data\PreventionData;
|
||||||
use App\Prevention\Mails\YearlyMail;
|
use App\Prevention\Mails\YearlyMail;
|
||||||
use App\Prevention\PreventionSettings;
|
use App\Prevention\PreventionSettings;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Support\Facades\Cache;
|
|
||||||
use Illuminate\Support\Facades\Mail;
|
use Illuminate\Support\Facades\Mail;
|
||||||
use Lorisleiva\Actions\Concerns\AsAction;
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
|
|
||||||
|
@ -41,14 +40,7 @@ class YearlyRememberAction
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Cache::remember(
|
|
||||||
'prevention-' . $member->id,
|
|
||||||
(int) now()->diffInSeconds(now()->addWeeks($settings->freshRememberInterval)),
|
|
||||||
function () use ($member, $preventions) {
|
|
||||||
Mail::send($this->createMail($member, $preventions));
|
Mail::send($this->createMail($member, $preventions));
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@ class PreventionSettings extends LocalSettings
|
||||||
public EditorData $formmail;
|
public EditorData $formmail;
|
||||||
public EditorData $yearlymail;
|
public EditorData $yearlymail;
|
||||||
public int $weeks;
|
public int $weeks;
|
||||||
public int $freshRememberInterval;
|
|
||||||
|
|
||||||
public static function group(): string
|
public static function group(): string
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,6 +8,5 @@ return new class extends SettingsMigration
|
||||||
{
|
{
|
||||||
$this->migrator->add('prevention.yearlymail', ['time' => 1, 'blocks' => [], 'version' => '1.0']);
|
$this->migrator->add('prevention.yearlymail', ['time' => 1, 'blocks' => [], 'version' => '1.0']);
|
||||||
$this->migrator->add('prevention.weeks', 8);
|
$this->migrator->add('prevention.weeks', 8);
|
||||||
$this->migrator->add('prevention.freshRememberInterval', 12);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -255,18 +255,6 @@ it('remembers members yearly', function ($date, $shouldSend) {
|
||||||
[fn() => now()->subYears(5)->subDay(), false],
|
[fn() => now()->subYears(5)->subDay(), false],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
it('remembers yearly only once', function () {
|
|
||||||
Mail::fake();
|
|
||||||
createMember(['efz' => now()->subYears(5), 'ps_at' => now(), 'has_vk' => true]);
|
|
||||||
|
|
||||||
YearlyRememberAction::run();
|
|
||||||
YearlyRememberAction::run();
|
|
||||||
YearlyRememberAction::run();
|
|
||||||
|
|
||||||
Mail::assertSentCount(1);
|
|
||||||
Mail::assertSent(YearlyMail::class, fn($mail) => $mail->preventions->first()->expires->isSameDay(now()));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('testItDoesntRememberParticipantThatHasNoMail', function () {
|
it('testItDoesntRememberParticipantThatHasNoMail', function () {
|
||||||
Mail::fake();
|
Mail::fake();
|
||||||
$form = createForm();
|
$form = createForm();
|
||||||
|
|
Loading…
Reference in New Issue