From 70dd13ea319be8b7806641b4612a3d275b93e650 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 17 Sep 2024 20:26:10 +0200 Subject: [PATCH] pint --- app/Http/Controllers/TrainingController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/TrainingController.php b/app/Http/Controllers/TrainingController.php index b5443c79..56f21e67 100644 --- a/app/Http/Controllers/TrainingController.php +++ b/app/Http/Controllers/TrainingController.php @@ -285,11 +285,11 @@ public function store(Request $request) } else { $res = $client->request('GET', 'https://api.vatsim.net/v2/members/819096/stats'); } - + // Process the data if we got a 200 OK if ($res->getStatusCode() == 200) { $vatsimStats = json_decode($res->getBody(), true); - + if (isset($vatsimStats[strtolower(\Auth::user()->rating_short)])) { $vatsimHours = $vatsimStats[strtolower(\Auth::user()->rating_short)]; } else { @@ -299,7 +299,7 @@ public function store(Request $request) return redirect()->back()->withErrors('We were unable to load the application for you due to missing data from VATSIM. Please try again later.'); } } catch (\GuzzleHttp\Exception\ClientException $e) { - + // If the resource returns 404 and user is S1, it just means the user has no hours yet and can apply for training if ($e->getResponse()->getStatusCode() == 404 && \Auth::user()->rating == VatsimRating::OBS->value) { $vatsimHours = 0;