followup service refacto

This commit is contained in:
Tykayn 2025-06-29 19:24:00 +02:00 committed by tykayn
parent 1c2c3575f9
commit 0611b28172
7 changed files with 341 additions and 596 deletions

View file

@ -146,7 +146,7 @@
'healthcare': 'bi-hospital',
'places': 'bi-geo-alt'
} %}
{% set type_labels = {
{% set followup_labels = {
'fire_hydrant': 'Bornes incendie',
'charging_station': 'Bornes de recharge',
'toilets': 'Toilettes publiques',
@ -197,7 +197,7 @@
<div class="card-body p-2">
<span class="completion-badge {{ completion_class }}"></span><br>
<i class="bi {{ followup_icons[type]|default('bi-question-circle') }} fs-2 mb-1"></i><br>
<a href="http://127.0.0.1:8111/import?url=https://overpass-api.de/api/interpreter?data={{ overpass_query|url_encode }}" target="_blank" class="fw-bold text-decoration-underline text-dark" title="Charger dans JOSM">{{ type_labels[type]|default(type|capitalize) }}</a><br>
<a href="http://127.0.0.1:8111/import?url=https://overpass-api.de/api/interpreter?data={{ overpass_query|url_encode }}" target="_blank" class="fw-bold text-decoration-underline text-dark" title="Charger dans JOSM">{{ followup_labels[type]|default(type|capitalize) }}</a><br>
<span title="Nombre"> {{ data.count is defined ? data.count.getMeasure() : '?' }}</span><br>
<span title="Complétion"> {{ completion is not null ? completion : '?' }}%</span>
</div>
@ -209,7 +209,7 @@
<div class="card-body p-2">
<span class="completion-badge" style="background:#eee;"></span><br>
<i class="bi bi-question-circle fs-2 mb-1"></i><br>
<span class="fw-bold">{{ type_labels[type]|default(type|capitalize) }}</span><br>
<span class="fw-bold">{{ followup_labels[type]|default(type|capitalize) }}</span><br>
<span title="Nombre">N = ?</span><br>
<span title="Complétion">?%</span>
</div>
@ -629,13 +629,18 @@
const place_relations = [];
const places = {{ geojson|raw }}.features;
places.forEach(place => {
if (place.properties.getOsmKind() === 'node') {
if (
place.properties.getOsmKind() === 'node'
) {
place_nodes.push(place.properties.id.split('/')[1]);
} elseif (place.properties.getOsmKind() === 'way') {
} else if (
place.properties.getOsmKind() === 'way'
) {
place_ways.push(place.properties.id.split('/')[1]);
} elseif (place.properties.getOsmKind() === 'relation') {
place_relations.push(place.properties.id.split('/')[1]);
}
// elseif (place.properties.getOsmKind() === 'relation') {
// place_relations.push(place.properties.id.split('/')[1]);
// }
});
const overpass_josm_query = '[out:xml][timeout:60];\n' +
(place_nodes.length > 0 ? 'node(id:' + place_nodes.join(',') + ');\n' : '') +