Compare commits

..

No commits in common. "1ee04edfc97c9aeb9432ca8fb651d20363e2b30c" and "b05d4529b4b4f4b6eca816cf24919d91fb38afe5" have entirely different histories.

6 changed files with 2 additions and 27 deletions

View File

@ -6,7 +6,6 @@ use App\Actions\DbMaintainAction;
use App\Form\Actions\PreventionRememberAction;
use App\Initialize\InitializeMembers;
use App\Invoice\Actions\InvoiceSendAction;
use App\Prevention\Actions\YearlyRememberAction;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
@ -22,7 +21,6 @@ class Kernel extends ConsoleKernel
InitializeMembers::class,
DbMaintainAction::class,
PreventionRememberAction::class,
YearlyRememberAction::class,
];
/**
@ -36,7 +34,6 @@ class Kernel extends ConsoleKernel
$schedule->command(InitializeMembers::class)->dailyAt('03:00');
$schedule->command(PreventionRememberAction::class)->dailyAt('11:00');
$schedule->command(InvoiceSendAction::class)->dailyAt('10:00');
$schedule->command(YearlyRememberAction::class)->dailyAt('09:00');
}
/**

View File

@ -7,7 +7,6 @@ use App\Prevention\Data\PreventionData;
use App\Prevention\Mails\YearlyMail;
use App\Prevention\PreventionSettings;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Mail;
use Lorisleiva\Actions\Concerns\AsAction;
@ -41,14 +40,7 @@ class YearlyRememberAction
continue;
}
Cache::remember(
'prevention-' . $member->id,
(int) now()->diffInSeconds(now()->addWeeks($settings->freshRememberInterval)),
function () use ($member, $preventions) {
Mail::send($this->createMail($member, $preventions));
return 0;
}
);
}
}

View File

@ -11,7 +11,6 @@ class PreventionSettings extends LocalSettings
public EditorData $formmail;
public EditorData $yearlymail;
public int $weeks;
public int $freshRememberInterval;
public static function group(): string
{

View File

@ -119,7 +119,7 @@ return [
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_database_'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
],
'default' => [

View File

@ -8,6 +8,5 @@ return new class extends SettingsMigration
{
$this->migrator->add('prevention.yearlymail', ['time' => 1, 'blocks' => [], 'version' => '1.0']);
$this->migrator->add('prevention.weeks', 8);
$this->migrator->add('prevention.freshRememberInterval', 12);
}
};

View File

@ -255,18 +255,6 @@ it('remembers members yearly', function ($date, $shouldSend) {
[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 () {
Mail::fake();
$form = createForm();