Skip to content

Commit

Permalink
fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
petertgiles committed Oct 31, 2024
1 parent 4d68c71 commit 6bb5b1d
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions api/app/Console/Commands/SendNotificationsPoolPublished.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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++;
}
}
Expand Down

0 comments on commit 6bb5b1d

Please sign in to comment.