Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
CalumTowers committed Jan 9, 2025
1 parent 18cff1b commit 133c883
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ public function __invoke()
}

foreach (request()->json('actions') as $action) {
if (class_exists($class = config("services.vatsim-net.webhook.jobs.{$action['action']}"))) {
$class = config("services.vatsim-net.webhook.jobs.{$action['action']}");
if ($class && class_exists($class)) {
dispatch(new $class(request()->json('resource'), $action));
// ->afterResponse();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function handle()
'id', 'name_first', 'name_last', 'email', 'reg_date' => $this->processAccountChange($delta['field'], $delta['after']),
'rating' => $this->processAtcRatingChange($delta['after']),
'pilotrating' => $this->processPilotRatingChange($delta['after']),
'division_id', 'region_id' => $this->processStateChange($delta['after']),
'division_id', 'region_id' => $this->processStateChange(),
default => null
};
}
Expand All @@ -53,10 +53,9 @@ private function processPilotRatingChange(mixed $value): void
Account::firstWhere('id', $this->memberId)->updateVatsimRatings(pilotRating: $value);
}

private function processStateChange(mixed $value): void
private function processStateChange(): void
{
// if both a division and region is changed in the deltas
// this will run twice, which is not ideal
dump('processing state change');

$account = Account::with('states')->firstWhere('id', $this->memberId);

Expand Down

0 comments on commit 133c883

Please sign in to comment.