Skip to content

Commit

Permalink
Fix numero di matricola.
Browse files Browse the repository at this point in the history
  • Loading branch information
robol committed Jan 23, 2024
1 parent a6ba249 commit d08c738
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion backend/src/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
class Application extends BaseApplication implements AuthenticationServiceProviderInterface
{
// Current CAPS version. This number is displayed in the web interface.
public static $_CAPSVERSION = '2.12.2';
public static $_CAPSVERSION = '2.12.3';

/**
* application version number
Expand Down
15 changes: 13 additions & 2 deletions backend/src/Controller/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,19 @@ public function oauth2Callback() {
);

$api_data = $client->getParsedResponse($request);
$number = $api_data['Corsi'][0]['Matricola'];
} catch (\Exception | \Error $e) {
$course_name = getenv('CAPS_CORSO_STUDIO');
$number = 0;
if ($course_name) {
foreach ($api_data['Corsi'] as $c) {
if ($c["Corso_studio"] == $course_name) {
$number = $c['Matricola'];
}
}
}
if ($number == 0) {
$number = $api_data['Corsi'][0]['Matricola'];
}
} catch (\Exception | \Error $e) {
$number = $uid;
}

Expand Down

0 comments on commit d08c738

Please sign in to comment.