From 6bb5b1d9860cbec7e3fdddfcdb4b65be0991d54a Mon Sep 17 00:00:00 2001 From: Peter Giles <8978655+petertgiles@users.noreply.github.com> Date: Thu, 31 Oct 2024 13:48:25 -0400 Subject: [PATCH] fix linting --- .../Commands/SendNotificationsPoolPublished.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/api/app/Console/Commands/SendNotificationsPoolPublished.php b/api/app/Console/Commands/SendNotificationsPoolPublished.php index be6aee80c29..aef5719556d 100644 --- a/api/app/Console/Commands/SendNotificationsPoolPublished.php +++ b/api/app/Console/Commands/SendNotificationsPoolPublished.php @@ -63,11 +63,16 @@ public function handle() $this->info('Found '.$poolsPublishedRecently->count().' pools.'); - $notifications = $poolsPublishedRecently->map(fn ($pool) => new NewJobPosted( - $pool->name['en'], - $pool->name['fr'], - $pool->id - )); + $notifications = $poolsPublishedRecently + ->map(fn ($model) => get_class($model) == Pool::class + ? new NewJobPosted( + $model->name['en'], + $model->name['fr'], + $model->id + ) + : null + ) + ->whereNotNull(); $successCount = 0; $failureCount = 0; @@ -83,7 +88,7 @@ public function handle() $successCount++; } catch (Throwable $e) { // best-effort: log and continue - $onDemandLog->error('Failed to send "new job posted" notification for "'.$notification->poolNameEn.'" ('.$notification->poolId.') to user " '.$user->firstName.' '.$user->lastName.' ('.$user->id.'). '.$e->getMessage()); + $onDemandLog->error('Failed to send "new job posted" notification for "'.$notification->poolNameEn.'" ('.$notification->poolId.') to user " '.$user->first_name.' '.$user->last_name.' ('.$user->id.'). '.$e->getMessage()); $failureCount++; } }