budget formaté en M€ sur le dashboard

This commit is contained in:
Tykayn 2025-06-24 13:31:14 +02:00 committed by tykayn
parent acb71e45e0
commit 1ad909cb86
2 changed files with 18 additions and 1 deletions

View file

@ -230,6 +230,23 @@ class FraicheurController extends AbstractController
ksort($villesByBinBudget);
ksort($villesByBinEcart);
// Remplir les bins vides pour l'histogramme budget par lieu (pas de 5000€)
if (!empty($histogramBudgetParLieu)) {
$minBin = min(array_map('intval', array_keys($histogramBudgetParLieu)));
$maxBin = max(array_map('intval', array_keys($histogramBudgetParLieu)));
for ($bin = $minBin; $bin <= $maxBin; $bin += 5000) {
$binStr = (string)$bin;
if (!isset($histogramBudgetParLieu[$binStr])) {
$histogramBudgetParLieu[$binStr] = 0;
}
if (!isset($villesByBinBudgetParLieu[$binStr])) {
$villesByBinBudgetParLieu[$binStr] = [];
}
}
ksort($histogramBudgetParLieu);
ksort($villesByBinBudgetParLieu);
}
ksort($histogramBudgetParLieu);
ksort($villesByBinBudgetParLieu);
$budgetData = [

View file

@ -168,7 +168,7 @@
<td>{{ stat.completionPercent }}%</td>
<td>{{ stat.placesCount }}</td>
<td>{{ (stat.placesCount / (stat.population or 1 ))|round(2) }}</td>
<td>{% if stat.budgetAnnuel %}{{ stat.budgetAnnuel|number_format(0, '.', ' ') }} {% else %}-{% endif %}</td>
<td>{% if stat.budgetAnnuel %}{{ (stat.budgetAnnuel / 1000000)|number_format(1, '.', ' ') }} M{% else %}-{% endif %}</td>
<td>{% if stat.budgetAnnuel and stat.population %}{{ (stat.budgetAnnuel / stat.population)|number_format(0, '.', ' ') }}{% else %}-{% endif %}</td>
<td>{% if stat.budgetAnnuel and stat.placesCount %}{{ (stat.budgetAnnuel / stat.placesCount)|number_format(0, '.', ' ') }}{% else %}-{% endif %}</td>
<td>{{ stat.osmDataDateAvg|date('Y-m-d H:i') }}</td>