add loggers actions
This commit is contained in:
parent
59398d14ba
commit
12d4db370f
22 changed files with 517 additions and 218 deletions
|
@ -80,7 +80,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
maintainAspectRatio: true,
|
||||
|
||||
plugins: {
|
||||
legend: { display: false },
|
||||
title: { display: true, text: 'Fraîcheur des données OSM (par mois)' }
|
||||
|
@ -126,7 +126,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
maintainAspectRatio: true,
|
||||
|
||||
plugins: {
|
||||
legend: { display: false },
|
||||
title: { display: true, text: 'Fraîcheur des données OSM (par trimestre)' }
|
||||
|
@ -166,7 +166,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
maintainAspectRatio: true,
|
||||
|
||||
plugins: {
|
||||
legend: { display: false },
|
||||
title: { display: true, text: 'Fraîcheur des données OSM (par année)' }
|
||||
|
@ -213,7 +213,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
maintainAspectRatio: true,
|
||||
|
||||
plugins: {
|
||||
legend: { display: false },
|
||||
title: { display: true, text: "Distribution des villes par habitants/lieu (par pas de 10)" },
|
||||
|
@ -258,7 +258,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
maintainAspectRatio: true,
|
||||
|
||||
plugins: {
|
||||
legend: { display: false },
|
||||
title: { display: true, text: "Distribution des villes par lieux/habitant (par pas de 0,01)" },
|
||||
|
@ -319,7 +319,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
maintainAspectRatio: true,
|
||||
|
||||
plugins: {
|
||||
legend: { display: false },
|
||||
title: { display: true, text: "Distribution des villes par budget par habitant (par pas de 100€)" },
|
||||
|
@ -365,7 +365,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
maintainAspectRatio: true,
|
||||
|
||||
plugins: {
|
||||
legend: { display: false },
|
||||
title: { display: true, text: "Distribution des villes par écart à la moyenne du budget par habitant (par pas de 10%)" },
|
||||
|
@ -411,7 +411,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
maintainAspectRatio: true,
|
||||
|
||||
plugins: {
|
||||
legend: { display: false },
|
||||
title: { display: true, text: "Distribution des villes par budget par lieu (par pas de 5000€)" },
|
||||
|
|
|
@ -34,5 +34,14 @@ commerces existants déjà en base: {{ commerces|length }}
|
|||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% if redirect_to_stats %}
|
||||
<script>
|
||||
setTimeout(function() {
|
||||
window.location.href = '{{ path('app_admin_stats', {'insee_code': zone}) }}';
|
||||
}, 5000);
|
||||
</script>
|
||||
<div class="alert alert-info mt-4">Vous allez être redirigé automatiquement vers la page de statistiques de la ville dans 5 secondes.</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
|
||||
{% if row.completion_pondere_normalisee is not null %}
|
||||
{{ row.completion_pondere_normalisee }}
|
||||
{% else %}
|
||||
|
|
|
@ -101,72 +101,7 @@
|
|||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{# Affichage de la fraîcheur des données OSM #}
|
||||
{# {% if stats.osmDataDateMin and stats.osmDataDateMax and stats.osmDataDateAvg %}
|
||||
{% set now = "now"|date("U") %}
|
||||
{% set minDate = stats.osmDataDateMin|date("U") %}
|
||||
{% set maxDate = stats.osmDataDateMax|date("U") %}
|
||||
{% set avgDate = stats.osmDataDateAvg|date("U") %}
|
||||
|
||||
{% set minDiff = now - minDate %}
|
||||
{% set maxDiff = now - maxDate %}
|
||||
{% set avgDiff = now - avgDate %}
|
||||
|
||||
{% set minYears = (minDiff / 31536000)|round(0, 'floor') %}
|
||||
{% set minMonths = ((minDiff % 31536000) / 2592000)|round(0, 'floor') %}
|
||||
{% set maxYears = (maxDiff / 31536000)|round(0, 'floor') %}
|
||||
{% set maxMonths = ((maxDiff % 31536000) / 2592000)|round(0, 'floor') %}
|
||||
{% set avgYears = (avgDiff / 31536000)|round(0, 'floor') %}
|
||||
{% set avgMonths = ((avgDiff % 31536000) / 2592000)|round(0, 'floor') %}
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-12">
|
||||
<div class="alert alert-info osm-freshness-info">
|
||||
<i class="bi bi-clock-history"></i>
|
||||
<strong>Fraîcheur des données OSM :</strong>
|
||||
{% if minYears == maxYears and minMonths == maxMonths %}
|
||||
Toutes les modifications ont été faites il y a
|
||||
{% if minYears > 0 %}
|
||||
{{ minYears }} an{{ minYears > 1 ? 's' : '' }}
|
||||
{% if minMonths > 0 %}, {{ minMonths }} mois{% endif %}
|
||||
{% elseif minMonths > 0 %}
|
||||
{{ minMonths }} mois
|
||||
{% else %}
|
||||
moins d'un mois
|
||||
{% endif %}
|
||||
{% else %}
|
||||
Les modifications ont été faites entre il y a
|
||||
{% if maxYears > 0 %}
|
||||
{{ maxYears }} an{{ maxYears > 1 ? 's' : '' }}
|
||||
{% if maxMonths > 0 %}, {{ maxMonths }} mois{% endif %}
|
||||
{% elseif maxMonths > 0 %}
|
||||
{{ maxMonths }} mois
|
||||
{% else %}
|
||||
moins d'un mois
|
||||
{% endif %}
|
||||
et il y a
|
||||
{% if minYears > 0 %}
|
||||
{{ minYears }} an{{ minYears > 1 ? 's' : '' }}
|
||||
{% if minMonths > 0 %}, {{ minMonths }} mois{% endif %}
|
||||
{% elseif minMonths > 0 %}
|
||||
{{ minMonths }} mois
|
||||
{% else %}
|
||||
moins d'un mois
|
||||
{% endif %},
|
||||
en moyenne il y a
|
||||
{% if avgYears > 0 %}
|
||||
{{ avgYears }} an{{ avgYears > 1 ? 's' : '' }}
|
||||
{% if avgMonths > 0 %}, {{ avgMonths }} mois{% endif %}
|
||||
{% elseif avgMonths > 0 %}
|
||||
{{ avgMonths }} mois
|
||||
{% else %}
|
||||
moins d'un mois
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %} #}
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-3 col-12">
|
||||
|
@ -258,9 +193,8 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="card mt-4">
|
||||
{% include 'admin/stats_history.html.twig' %}
|
||||
<div id="distribution_completion" class="mt-4 mb-4"></div>
|
||||
<div id="distribution_budget_habitant" class="mt-4 mb-4"></div>
|
||||
{% include 'admin/stats_history.html.twig' with {stat: stats} %}
|
||||
<canvas id="distribution_completion" class="mt-4 mb-4" height="600"></canvas>
|
||||
|
||||
|
||||
<div class="row">
|
||||
|
@ -603,8 +537,7 @@
|
|||
}]
|
||||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
maintainAspectRatio: true,
|
||||
responsive: true,
|
||||
plugins: {
|
||||
legend: {
|
||||
position: 'right',
|
||||
|
@ -644,7 +577,7 @@ if(dc ){
|
|||
return ;
|
||||
}
|
||||
new Chart(completionCtx, {
|
||||
type: 'bar',
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: completionLabels,
|
||||
datasets: [{
|
||||
|
@ -661,59 +594,13 @@ if(dc ){
|
|||
beginAtZero: true
|
||||
}
|
||||
},
|
||||
responsive: true,
|
||||
maintainAspectRatio: false
|
||||
responsive: true,
|
||||
}
|
||||
});
|
||||
}else{
|
||||
console.log('pas de distribution_completion')
|
||||
}
|
||||
|
||||
// === Distribution du budget par habitant (écart à la moyenne, pas de 3%) ===
|
||||
const budgetEcartData = [];
|
||||
{% for commerce in stats.places %}
|
||||
{% if commerce.getBudgetParHabitantEcartPourcent is defined %}
|
||||
budgetEcartData.push({{ commerce.getBudgetParHabitantEcartPourcent()|default(0) }});
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
const budgetEcartDistribution = {};
|
||||
budgetEcartData.forEach(ecart => {
|
||||
const range = Math.floor(ecart / 3) * 3;
|
||||
const key = `${range}% à ${range + 3}%`;
|
||||
budgetEcartDistribution[key] = (budgetEcartDistribution[key] || 0) + 1;
|
||||
});
|
||||
const budgetEcartLabels = Object.keys(budgetEcartDistribution).sort((a, b) => parseInt(a) - parseInt(b));
|
||||
const budgetEcartValues = budgetEcartLabels.map(label => budgetEcartDistribution[label]);
|
||||
const dbh = document.getElementById('distribution_budget_habitant');
|
||||
if(dbh){
|
||||
const budgetEcartCtx = dbh.getContext ? dbh.getContext('2d') : null;
|
||||
if(!budgetEcartCtx){
|
||||
console.log('pas de budgetEcartCtx');
|
||||
} else {
|
||||
new Chart(budgetEcartCtx, {
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: budgetEcartLabels,
|
||||
datasets: [{
|
||||
label: 'Distribution des villes selon l\'écart à la moyenne du budget par habitant (pas 3%)',
|
||||
data: budgetEcartValues,
|
||||
backgroundColor: 'rgba(255, 206, 86, 0.5)',
|
||||
borderColor: 'rgba(255, 206, 86, 1)',
|
||||
borderWidth: 1
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
scales: {
|
||||
y: {
|
||||
beginAtZero: true
|
||||
}
|
||||
},
|
||||
responsive: true,
|
||||
maintainAspectRatio: false
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
|
|
|
@ -33,25 +33,42 @@
|
|||
{{ commerce.getCompletionPercentage() }}
|
||||
|
||||
<div class='p-2'>
|
||||
<h6>Infos manquantes :</h6>
|
||||
<ul class='list-unstyled mb-0'>
|
||||
{# <h6>Infos manquantes :</h6> #}
|
||||
<ul class='list-unstyled list-inline mb-0'>
|
||||
{% if not commerce.name %}
|
||||
<li><i class='bi bi-x-circle text-danger'></i> Nom du commerce</li>
|
||||
<span title="Nom du commerce">
|
||||
<i class='bi bi-person-badge text-danger'></i>
|
||||
</span>
|
||||
{% endif %}
|
||||
{% if not commerce.hasAddress() %}
|
||||
<li><i class='bi bi-x-circle text-danger'></i> Adresse complète</li>
|
||||
<span title="Adresse complète">
|
||||
<i class='bi bi-geo-alt text-danger'></i>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if not commerce.hasOpeningHours() %}
|
||||
<li><i class='bi bi-x-circle text-danger'></i> Horaires d'ouverture</li>
|
||||
<span title="Horaires d'ouverture">
|
||||
<i class='bi bi-clock text-danger'></i>
|
||||
</span>
|
||||
{% endif %}
|
||||
{% if not commerce.hasWebsite() %}
|
||||
<li><i class='bi bi-x-circle text-danger'></i> Site web</li>
|
||||
<span title="Site web">
|
||||
<i class='bi bi-globe text-danger'></i>
|
||||
</span>
|
||||
{% endif %}
|
||||
{# {% if not commerce.phone %}
|
||||
<li><i class='bi bi-x-circle text-danger'></i> Téléphone</li>
|
||||
<li title="Téléphone">
|
||||
<i class='bi bi-telephone text-danger'></i>
|
||||
</li>
|
||||
{% endif %} #}
|
||||
{% if not commerce.hasWheelchair() %}
|
||||
<li><i class='bi bi-x-circle text-danger'></i> Accessibilité PMR</li>
|
||||
<span title="Accessibilité PMR">
|
||||
<i class='bi bi-universal-access text-danger'></i>
|
||||
</span>
|
||||
{% endif %}
|
||||
{% if not commerce.siret %}
|
||||
<span title="SIRET">
|
||||
<i class='bi bi-book text-danger'></i>
|
||||
</span>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<h2>Évolution du taux de complétion</h2>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<canvas id="completionHistoryChart"></canvas>
|
||||
<canvas id="completionHistoryChart" height="500"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -32,7 +32,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
0{% if not loop.last %},{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
];
|
||||
];
|
||||
|
||||
const addressData = [
|
||||
{% for stat in statsHistory|reverse %}
|
||||
|
@ -73,6 +73,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
{% endif %}
|
||||
{% endfor %}
|
||||
];
|
||||
const completionStat = {{stat.getCompletionPercent()}}
|
||||
|
||||
new Chart(ctx, {
|
||||
type: 'line',
|
||||
|
@ -140,7 +141,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
plugins: {
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Évolution des taux de complétion par aspect au fil du temps'
|
||||
text: 'Évolution des taux de complétion dans le temps => '+completionStat
|
||||
},
|
||||
legend: {
|
||||
position: 'top',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue