ajout de suivi des parkings vélo

This commit is contained in:
Tykayn 2025-06-29 19:38:54 +02:00 committed by tykayn
parent 0611b28172
commit 4fbdcfc704
5 changed files with 37 additions and 5 deletions

View file

@ -79,6 +79,13 @@ class FollowUpController extends AbstractController
'name' => $fu->getName(),
];
}
// Tri par date dans chaque série
foreach ($series as &$points) {
usort($points, function($a, $b) {
return strtotime($a['date']) <=> strtotime($b['date']);
});
}
unset($points);
return $this->render('admin/followup_graph.html.twig', [
'stats' => $stats,
'series' => $series,
@ -126,6 +133,13 @@ class FollowUpController extends AbstractController
'name' => $fu->getName(),
];
}
// Tri par date dans chaque série
foreach ($series as &$points) {
usort($points, function($a, $b) {
return strtotime($a['date']) <=> strtotime($b['date']);
});
}
unset($points);
return $this->render('admin/followup_global_graph.html.twig', [
'stats' => $stats,
'series' => $series,

View file

@ -46,6 +46,8 @@ class FollowUpService
|| ($el['tags']['amenity'] ?? null) === 'clinic'
|| ($el['tags']['amenity'] ?? null) === 'social_facility';
}) ?? [];
} elseif ($type === 'bicycle_parking') {
$objects = array_filter($elements, fn($el) => ($el['tags']['amenity'] ?? null) === 'bicycle_parking') ?? [];
} else {
$objects = [];
}
@ -118,6 +120,10 @@ class FollowUpService
|| !empty($tags['email'] ?? null)
|| !empty($tags['contact:email'] ?? null);
});
} elseif ($type === 'bicycle_parking') {
$completed = array_filter($data['objects'], function($el) {
return !empty($el['tags']['capacity'] ?? null) || !empty($el['tags']['covered'] ?? null);
});
}
$completion = count($data['objects']) > 0 ? round(count($completed) / count($data['objects']) * 100) : 0;
$followupCompletion = new CityFollowUp();
@ -231,6 +237,7 @@ class FollowUpService
'school' => 'Écoles',
'police' => 'Commissariats',
'healthcare' => 'Lieux de santé',
'bicycle_parking' => 'Parkings vélos',
'places' => 'Lieux'
];
}
@ -250,6 +257,7 @@ class FollowUpService
'school' => 'bi-mortarboard',
'police' => 'bi-shield-lock',
'healthcare' => 'bi-hospital',
'bicycle_parking' => 'bi-bicycle',
'places' => 'bi-geo-alt'
];
}
@ -269,6 +277,7 @@ class FollowUpService
'school' => 'nwr["amenity"="school"](area.searchArea);',
'police' => 'nwr["amenity"="police"](area.searchArea);',
'healthcare' => 'nwr["healthcare"](area.searchArea);nwr["amenity"="doctors"](area.searchArea);nwr["amenity"="pharmacy"](area.searchArea);nwr["amenity"="hospital"](area.searchArea);nwr["amenity"="clinic"](area.searchArea);nwr["amenity"="social_facility"](area.searchArea);',
'bicycle_parking' => 'nwr["amenity"="bicycle_parking"](area.searchArea);',
'places' => ''
];
}

View file

@ -582,6 +582,7 @@ area["ref:INSEE"="$zone"]->.searchArea;
nwr["healthcare"="laboratory"](area.searchArea);
nwr["amenity"="school"](area.searchArea);
nwr["amenity"="police"](area.searchArea);
nwr["amenity"="bicycle_parking"](area.searchArea);
);
(._;>;);
out meta;