Skip to content

Commit

Permalink
pint
Browse files Browse the repository at this point in the history
  • Loading branch information
blt950 committed Sep 17, 2024
1 parent 3950aa2 commit 70dd13e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/Http/Controllers/TrainingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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;
Expand Down

0 comments on commit 70dd13e

Please sign in to comment.