Open
Description
Bonjour
Je voudrais bien faire une pull request mais j'ai pas réussi a en créer.
L'idée étant d'afficher l'alerte de trafic la plus récente pour être plus conforme à ce qu'affiche la RATP comme information.
Pour y arriver je propose ce code dans le service RatpTrafficService.php
// Collect specific errors : Travaux
if (isset($errors['Travaux'])) {
array_push($events, current($errors['Travaux']));
}
// Collect specific errors : Incident
if (isset($errors['Incidents techniques'])) {
array_push($events, current($errors['Incidents techniques']));
}
// Collect specific errors : Grève
if (isset($errors['Mouvement social'])) {
array_push($events, current($errors['Mouvement social']));
}
// If no specific errors ! Collect all available errors
if (empty($events)) {
$events = current($errors);
}
// Sort events to get the recent event on top
usort($events, function ($event1, $event2) {
return $event2['startDate'] <=> $event1['startDate'];
}
// Take the first event on the events list (the recent one)
$event = reset($events);
- L' information donnée par la RATP en capture ici :
- La version d'API actuelle donne ça :
- La version avec mon fix donne ça :
Merci !
Metadata
Metadata
Assignees
Labels
No labels