fix routes

This commit is contained in:
Tykayn 2025-09-09 15:56:30 +02:00 committed by tykayn
parent 7d76d6efa5
commit 349b45ef83
5 changed files with 85 additions and 14 deletions

1
.gitignore vendored
View file

@ -37,3 +37,4 @@ public/*.json
html_cache/*
/html_cache/
activate

View file

@ -137,14 +137,14 @@ class WikiController extends AbstractController
$alignedSections = [];
// First, process common sections (they already have both en and fr)
// if (isset($sectionComparison['common']) && is_array($sectionComparison['common'])) {
// foreach ($sectionComparison['common'] as $section) {
// $alignedSections[] = [
// 'en' => $section['en'],
// 'fr' => $section['fr']
// ];
// }
// }
if (isset($sectionComparison['common']) && is_array($sectionComparison['common'])) {
foreach ($sectionComparison['common'] as $section) {
$alignedSections[] = [
'en' => $section['en'],
'fr' => $section['fr']
];
}
}
// Then, process English-only sections and add empty placeholders for French
if (isset($sectionComparison['en_only']) && is_array($sectionComparison['en_only'])) {
@ -162,8 +162,8 @@ class WikiController extends AbstractController
];
}
}
//
// // Finally, process French-only sections (these will be shown at the end)
// Finally, process French-only sections (these will be shown at the end)
if (isset($sectionComparison['fr_only']) && is_array($sectionComparison['fr_only'])) {
foreach ($sectionComparison['fr_only'] as $section) {
$alignedSections[] = [
@ -1040,7 +1040,8 @@ EOT;
$globalMetrics = $entry['global_metrics'];
// Format date for display
$formattedDate = (new \DateTime($date))->format('Y-m-d');
$formattedDate = is_string($date) && !empty($date) && $date !== '0' ?
(new \DateTime($date))->format('Y-m-d') : 'N/A';
$metrics['dates'][] = $formattedDate;
// Get average staleness score
@ -1061,7 +1062,8 @@ EOT;
// Process history entries
foreach ($historyEntries as $date => $entry) {
// Format date for display
$formattedDate = (new \DateTime($date))->format('Y-m-d');
$formattedDate = is_string($date) && !empty($date) && $date !== '0' ?
(new \DateTime($date))->format('Y-m-d') : 'N/A';
// If date already exists in metrics, use the same index
$dateIndex = array_search($formattedDate, $metrics['dates']);

View file

@ -13,12 +13,74 @@
</a>
</p>
<div class="card mb-4 text-white">
<div class="card-img-overlay d-flex flex-column justify-content-center" style="background: linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0.7)), url('https://wiki.openstreetmap.org/w/images/thumb/7/79/OSM_Logo.svg/256px-OSM_Logo.svg.png') no-repeat center center; background-size: cover; min-height: 300px;">
<h2 class="card-title">Pages ayant le plus besoin de mise à jour</h2>
<div class="row">
{% set top_pages = [] %}
{% for key, languages in wiki_pages|slice(0, 5) %}
{% if languages['en'] is defined and languages['fr'] is defined %}
{% set score = languages['en'].staleness_score|default(0) %}
{% if score > 20 %}
{% set top_pages = top_pages|merge([{'key': key, 'score': score, 'url': path('app_admin_wiki_compare', {'key': key})}]) %}
{% endif %}
{% endif %}
{% endfor %}
{% for page in top_pages|sort((a, b) => b.score <=> a.score)|slice(0, 3) %}
<div class="col-md-4 mb-3">
<div class="card bg-dark">
<div class="card-body">
<h5 class="card-title">{{ page.key }}</h5>
<p class="card-text">Score de décrépitude:
<span class="badge {% if page.score > 50 %}bg-danger{% elseif page.score > 20 %}bg-warning text-dark{% else %}bg-success{% endif %}">
{{ page.score }}
</span>
</p>
<a href="{{ page.url }}" class="btn btn-primary">Comparer</a>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
<div class="card mb-4">
<div class="card-header">
<h2>Liste des pages wiki</h2>
</div>
<div class="card-body">
<!-- Highlight first 3 pages with large images -->
<div class="row mb-4">
{% set count = 0 %}
{% for key, languages in wiki_pages %}
{% if languages['en'] is defined and languages['fr'] is defined and count < 3 %}
<div class="col-md-4 mb-3">
<div class="card h-100">
<a href="{{ path('app_admin_wiki_compare', {'key': key}) }}" class="text-decoration-none">
<img src="{{ languages['en'].description_img_url }}" class="card-img-top" alt="{{ key }}" style="height: 200px; object-fit: contain; padding: 10px;">
<div class="card-body text-center">
<h5 class="card-title">{{ key }}</h5>
{% set score = languages['en'].staleness_score|default(0) %}
{# <p class="card-text">Score de décrépitude: #}
{# <span class="badge {% if score > 50 %}bg-danger{% elseif score > 20 %}bg-warning text-dark{% else %}bg-success{% endif %}">#}
{# {{ score }}#}
{# </span>#}
{# </p>#}
</div>
</a>
</div>
</div>
{% set count = count + 1 %}
{% endif %}
{% endfor %}
<p>
Ces pages sont celles qui ont le plus besoin d'une mise à jour
</p>
</div>
{% if wiki_pages_stats is defined %}
<div class="alert alert-info mb-3">
<h4>Statistiques des pages wiki</h4>

View file

@ -46,6 +46,12 @@
Tableau de bord
</a>
</li>
<li class="nav-item">
<a class="nav-link text-white {% if app.request.get('_route') == 'app_admin_wiki_rankings' %}active{% endif %}" href="{{ path('app_admin_wiki_rankings') }}">
<i class="bi bi-speedometer2"></i>
Classements de pages
</a>
</li>
<li class="nav-item">
<a class="nav-link text-white {% if app.request.get('_route') == 'app_admin_wiki_decrepitude' %}active{% endif %}" href="{{ path('app_admin_wiki_decrepitude') }}">
<i class="bi bi-graph-up"></i>

View file

@ -10,8 +10,8 @@ Tag:harassment_prevention=ask_angela,en,https://wiki.openstreetmap.org/wiki/Tag:
Tag:harassment_prevention=ask_angela,fr,https://wiki.openstreetmap.org/wiki/FR:Tag:harassment_prevention=ask_angela,2025-09-01,20,873,166,15,42.56,https://wiki.openstreetmap.org/w/images/thumb/1/15/2024-06-27T08.40.50_ask_angela_lyon.jpg/200px-2024-06-27T08.40.50_ask_angela_lyon.jpg
Key:harassment_prevention,en,https://wiki.openstreetmap.org/wiki/Key:harassment_prevention,2024-08-10,12,196,69,14,66.72,https://wiki.openstreetmap.org/w/images/thumb/7/76/Osm_element_node.svg/30px-Osm_element_node.svg.png
Key:harassment_prevention,fr,https://wiki.openstreetmap.org/wiki/FR:Key:harassment_prevention,2025-07-03,15,328,83,14,66.72,https://wiki.openstreetmap.org/w/images/thumb/7/76/Osm_element_node.svg/30px-Osm_element_node.svg.png
Proposal process,en,https://wiki.openstreetmap.org/wiki/Proposal process,2025-08-13,46,5292,202,4,172.34,https://wiki.openstreetmap.org/w/images/thumb/c/c2/Save_proposal_first.png/761px-Save_proposal_first.png
Proposal process,fr,https://wiki.openstreetmap.org/wiki/FR:Proposal process,2023-09-22,15,0,0,0,172.34,
Proposal process,en,https://wiki.openstreetmap.org/wiki/Proposal process,2025-08-13,47,5286,214,4,172.64,https://wiki.openstreetmap.org/w/images/thumb/c/c2/Save_proposal_first.png/761px-Save_proposal_first.png
Proposal process,fr,https://wiki.openstreetmap.org/wiki/FR:Proposal process,2023-09-22,15,0,0,0,172.64,
Outil de Manipulation et d'Organisation,en,https://wiki.openstreetmap.org/wiki/Outil de Manipulation et d'Organisation,2025-09-02,9,0,0,0,0.6,
Outil de Manipulation et d'Organisation,fr,https://wiki.openstreetmap.org/wiki/FR:Outil de Manipulation et d'Organisation,2025-09-02,13,0,0,0,0.6,
Automated_Edits_code_of_conduct,en,https://wiki.openstreetmap.org/wiki/Automated_Edits_code_of_conduct,2025-07-26,19,0,0,0,23.1,

1 key language url last_modified sections word_count link_count media_count staleness_score description_img_url
10 Tag:harassment_prevention=ask_angela fr https://wiki.openstreetmap.org/wiki/FR:Tag:harassment_prevention=ask_angela 2025-09-01 20 873 166 15 42.56 https://wiki.openstreetmap.org/w/images/thumb/1/15/2024-06-27T08.40.50_ask_angela_lyon.jpg/200px-2024-06-27T08.40.50_ask_angela_lyon.jpg
11 Key:harassment_prevention en https://wiki.openstreetmap.org/wiki/Key:harassment_prevention 2024-08-10 12 196 69 14 66.72 https://wiki.openstreetmap.org/w/images/thumb/7/76/Osm_element_node.svg/30px-Osm_element_node.svg.png
12 Key:harassment_prevention fr https://wiki.openstreetmap.org/wiki/FR:Key:harassment_prevention 2025-07-03 15 328 83 14 66.72 https://wiki.openstreetmap.org/w/images/thumb/7/76/Osm_element_node.svg/30px-Osm_element_node.svg.png
13 Proposal process en https://wiki.openstreetmap.org/wiki/Proposal process 2025-08-13 46 47 5292 5286 202 214 4 172.34 172.64 https://wiki.openstreetmap.org/w/images/thumb/c/c2/Save_proposal_first.png/761px-Save_proposal_first.png
14 Proposal process fr https://wiki.openstreetmap.org/wiki/FR:Proposal process 2023-09-22 15 0 0 0 172.34 172.64
15 Outil de Manipulation et d'Organisation en https://wiki.openstreetmap.org/wiki/Outil de Manipulation et d'Organisation 2025-09-02 9 0 0 0 0.6
16 Outil de Manipulation et d'Organisation fr https://wiki.openstreetmap.org/wiki/FR:Outil de Manipulation et d'Organisation 2025-09-02 13 0 0 0 0.6
17 Automated_Edits_code_of_conduct en https://wiki.openstreetmap.org/wiki/Automated_Edits_code_of_conduct 2025-07-26 19 0 0 0 23.1