This commit is contained in:
Tykayn 2025-09-03 17:18:21 +02:00 committed by tykayn
parent 0df830f93d
commit 2ad98b5864
11 changed files with 808 additions and 224 deletions

View file

@ -51,6 +51,11 @@
<i class="bi bi-clock-history"></i> Changements récents
</a>
</li>
<li class="nav-item">
<a class="nav-link {% if app.request.get('_route') == 'app_admin_wiki_decrepitude' %}active{% endif %}" href="{{ path('app_admin_wiki_decrepitude') }}">
<i class="bi bi-graph-up"></i> Scores de décrépitude
</a>
</li>
</ul>
</div>
</div>

View file

@ -20,6 +20,31 @@
</div>
<div class="card-body">
{% if wiki_pages_stats is defined %}
<div class="alert alert-info mb-3">
<h4>Statistiques des pages wiki</h4>
<div class="row">
<div class="col-md-6">
<h5>Pages en anglais</h5>
<ul>
<li><strong>Sections :</strong> Moyenne: {{ wiki_pages_stats.en_sections.mean }}, Écart type: {{ wiki_pages_stats.en_sections.std_dev }}</li>
<li><strong>Mots :</strong> Moyenne: {{ wiki_pages_stats.en_words.mean }}, Écart type: {{ wiki_pages_stats.en_words.std_dev }}</li>
<li><strong>Liens :</strong> Moyenne: {{ wiki_pages_stats.en_links.mean }}, Écart type: {{ wiki_pages_stats.en_links.std_dev }}</li>
<li><strong>Images :</strong> Moyenne: {{ wiki_pages_stats.en_media.mean }}, Écart type: {{ wiki_pages_stats.en_media.std_dev }}</li>
</ul>
</div>
<div class="col-md-6">
<h5>Pages en français</h5>
<ul>
<li><strong>Sections :</strong> Moyenne: {{ wiki_pages_stats.fr_sections.mean }}, Écart type: {{ wiki_pages_stats.fr_sections.std_dev }}</li>
<li><strong>Mots :</strong> Moyenne: {{ wiki_pages_stats.fr_words.mean }}, Écart type: {{ wiki_pages_stats.fr_words.std_dev }}</li>
<li><strong>Liens :</strong> Moyenne: {{ wiki_pages_stats.fr_links.mean }}, Écart type: {{ wiki_pages_stats.fr_links.std_dev }}</li>
<li><strong>Images :</strong> Moyenne: {{ wiki_pages_stats.fr_media.mean }}, Écart type: {{ wiki_pages_stats.fr_media.std_dev }}</li>
</ul>
</div>
</div>
</div>
{% endif %}
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead class="thead-dark">
@ -283,12 +308,13 @@
<thead class="thead-dark">
<tr>
<th>Titre</th>
<th>Score de décrépitude</th>
{# <th>Score de décrépitude</th>#}
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for page in pages_unavailable_in_english %}
{% if "FR:Réunions" not in page.title %}
<tr>
<td>
<div class="d-flex align-items-center">
@ -303,22 +329,22 @@
</div>
</div>
</td>
<td>
{% if page.outdatedness_score is defined %}
<div class="progress" style="height: 20px;">
{% set score_class = page.outdatedness_score > 70 ? 'bg-danger' : (page.outdatedness_score > 40 ? 'bg-warning' : 'bg-success') %}
<div class="progress-bar {{ score_class }}" role="progressbar"
style="width: {{ page.outdatedness_score }}%;"
aria-valuenow="{{ page.outdatedness_score }}"
aria-valuemin="0"
aria-valuemax="100">
{{ page.outdatedness_score }}
</div>
</div>
{% else %}
<span class="text-muted">Non disponible</span>
{% endif %}
</td>
{# <td>#}
{# {% if page.outdatedness_score is defined %}#}
{# <div class="progress" style="height: 20px;">#}
{# {% set score_class = page.outdatedness_score > 70 ? 'bg-danger' : (page.outdatedness_score > 40 ? 'bg-warning' : 'bg-success') %}#}
{# <div class="progress-bar {{ score_class }}" role="progressbar"#}
{# style="width: {{ page.outdatedness_score }}%;"#}
{# aria-valuenow="{{ page.outdatedness_score }}"#}
{# aria-valuemin="0"#}
{# aria-valuemax="100">#}
{# {{ page.outdatedness_score }}#}
{# </div>#}
{# </div>#}
{# {% else %}#}
{# <span class="text-muted">Non disponible</span>#}
{# {% endif %}#}
{# </td>#}
<td class="text-center">
<div class="btn-group" role="group">
<a href="{{ page.url }}" target="_blank"
@ -334,6 +360,7 @@
</div>
</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
@ -413,6 +440,16 @@
<h2>Graphe de décrépitude</h2>
</div>
<div class="card-body">
{% if staleness_stats is defined %}
<div class="alert alert-info mb-3">
<strong>Statistiques :</strong>
Moyenne : {{ staleness_stats.mean }} |
Écart type : {{ staleness_stats.std_dev }} |
Min : {{ staleness_stats.min }} |
Max : {{ staleness_stats.max }} |
Nombre de pages : {{ staleness_stats.count }}
</div>
{% endif %}
<canvas id="decrepitudeChart" height="300"></canvas>
</div>
</div>
@ -436,13 +473,19 @@
{% set score = languages['en'].staleness_score|default(0) %}
scores.push({{ score }});
// Set color based on score
{% if score > 50 %}
colors.push('rgba(220, 53, 69, 0.7)'); // danger
// Set color based on score with more nuanced intermediate colors
{% if score > 80 %}
colors.push('rgba(220, 53, 69, 0.7)'); // danger (red)
{% elseif score > 60 %}
colors.push('rgba(232, 113, 55, 0.7)'); // dark orange
{% elseif score > 40 %}
colors.push('rgba(255, 153, 0, 0.7)'); // orange
{% elseif score > 20 %}
colors.push('rgba(255, 193, 7, 0.7)'); // warning
colors.push('rgba(255, 193, 7, 0.7)'); // warning (yellow)
{% elseif score > 10 %}
colors.push('rgba(140, 195, 38, 0.7)'); // light green
{% else %}
colors.push('rgba(25, 135, 84, 0.7)'); // success
colors.push('rgba(25, 135, 84, 0.7)'); // success (green)
{% endif %}
{% endif %}
{% endfor %}

View file

@ -112,8 +112,8 @@
<a href="{{ fr_page.url|default('https://wiki.openstreetmap.org/wiki/FR:' ~ key) }}">fr</a>
<a href="{{ en_page.url }}">en</a>
{% else %}
<a href="https://wiki.openstreetmap.org/wiki/FR:Key:{{ key }}">fr</a>
<a href="https://wiki.openstreetmap.org/wiki/Key:{{ key }}">en</a>
<a href="https://wiki.openstreetmap.org/wiki/FR:{{ key }}">fr</a>
<a href="https://wiki.openstreetmap.org/wiki/{{ key }}">en</a>
{% endif %}
</h1>
@ -738,164 +738,164 @@
{# {% endif %} #}
{# <div class="card mb-4"> #}
{# <div class="card-header"> #}
{# <h2>Score de décrépitude</h2> #}
{# </div> #}
{# <div class="card-body"> #}
{# <p>Le score de décrépitude est calculé en prenant en compte plusieurs facteurs, avec une pondération #}
{# plus importante pour la différence de nombre de mots :</p> #}
<div class="card mb-4">
<div class="card-header">
<h2>Score de décrépitude</h2>
</div>
<div class="card-body">
<p>Le score de décrépitude est calculé en prenant en compte plusieurs facteurs, avec une pondération
plus importante pour la différence de nombre de mots :</p>
{# <div class="table-responsive"> #}
{# <table class="table table-striped"> #}
{# <thead> #}
{# <tr> #}
{# <th>Facteur</th> #}
{# <th>Valeur</th> #}
{# <th>Poids</th> #}
{# <th>Contribution</th> #}
{# </tr> #}
{# </thead> #}
{# <tbody> #}
{# {% for key, component in score_components %} #}
{# <tr> #}
{# <td>{{ component.description }}</td> #}
{# <td>{{ component.value }}</td> #}
{# <td>{{ component.weight * 100 }}%</td> #}
{# <td>{{ component.component|round(2) }}</td> #}
{# </tr> #}
{# {% endfor %} #}
{# <tr class="table-dark"> #}
{# <td colspan="3"><strong>Score total</strong></td> #}
{# <td> #}
{# {% set total_score = 0 %} #}
{# {% for key, component in score_components %} #}
{# {% set total_score = total_score + component.component %} #}
{# {% endfor %} #}
{# <strong>{{ total_score|round(2) }}</strong> #}
{# </td> #}
{# </tr> #}
{# </tbody> #}
{# </table> #}
{# </div> #}
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Facteur</th>
<th>Valeur</th>
<th>Poids</th>
<th>Contribution</th>
</tr>
</thead>
<tbody>
{% for key, component in score_components %}
<tr>
<td>{{ component.description }}</td>
<td>{{ component.value }}</td>
<td>{{ component.weight * 100 }}%</td>
<td>{{ component.component|round(2) }}</td>
</tr>
{% endfor %}
<tr class="table-dark">
<td colspan="3"><strong>Score total</strong></td>
<td>
{% set total_score = 0 %}
{% for key, component in score_components %}
{% set total_score = total_score + component.component %}
{% endfor %}
<strong>{{ total_score|round(2) }}</strong>
</td>
</tr>
</tbody>
</table>
</div>
{# <div class="alert alert-info"> #}
{# <p><strong>Comment interpréter ce score :</strong></p> #}
{# <ul> #}
{# <li>Plus le score est élevé, plus la page française est considérée comme "décrépite" par rapport #}
{# à la version anglaise. #}
{# </li> #}
{# <li>La différence de nombre de mots compte pour 50% du score, car c'est l'indicateur le plus #}
{# important de la complétude de la traduction. #}
{# </li> #}
{# <li>Les différences de sections (15%), de liens (15%) et de date de modification (20%) #}
{# complètent le score. #}
{# </li> #}
{# </ul> #}
{# </div> #}
{# </div> #}
{# </div> #}
<div class="alert alert-info">
<p><strong>Comment interpréter ce score :</strong></p>
<ul>
<li>Plus le score est élevé, plus la page française est considérée comme "décrépite" par rapport
à la version anglaise.
</li>
<li>La différence de nombre de mots compte pour 50% du score, car c'est l'indicateur le plus
important de la complétude de la traduction.
</li>
<li>Les différences de sections (15%), de liens (15%) et de date de modification (20%)
complètent le score.
</li>
</ul>
</div>
</div>
</div>
{# <div class="mt-3"> #}
{# <a href="{{ path('app_admin_wiki') }}" class="btn btn-secondary"> #}
{# <i class="bi bi-arrow-left"></i> Retour à la liste des pages wiki #}
{# </a> #}
{# </div> #}
{# <div class="card mb-4"> #}
{# <div class="card-header"> #}
{# <h2>Comparaison des versions</h2> #}
{# </div> #}
{# <div class="card-body"> #}
{# <div class="row"> #}
{# <div class="col-md-6"> #}
{# <div class="card h-100"> #}
{# <div class="card-header bg-primary text-white"> #}
{# <h3>Version anglaise</h3> #}
{# <p class="mb-0"> #}
{# <small>Dernière modification: {{ en_page.last_modified }}</small> #}
{# </p> #}
{# </div> #}
{# <div class="card-body"> #}
{# <ul class="list-group mb-3"> #}
{# <li class="list-group-item d-flex justify-content-between align-items-center"> #}
{# Sections #}
{# <span class="badge bg-primary rounded-pill"> #}
{# {% if detailed_comparison.adjusted_en_section_count is defined %} #}
{# {{ detailed_comparison.adjusted_en_section_count }} #}
{# {% else %} #}
{# {{ en_page.sections }} #}
{# {% endif %} #}
{# </span> #}
{# </li> #}
{# <li class="list-group-item d-flex justify-content-between align-items-center"> #}
{# Mots #}
{# <span class="badge bg-primary rounded-pill">{{ en_page.word_count }}</span> #}
{# </li> #}
{# <li class="list-group-item d-flex justify-content-between align-items-center"> #}
{# Liens #}
{# <span class="badge bg-primary rounded-pill">{{ en_page.link_count }}</span> #}
{# </li> #}
{# </ul> #}
{# <div class="d-grid gap-2"> #}
{# <a href="{{ en_page.url }}" target="_blank" class="btn btn-outline-primary"> #}
{# <i class="bi bi-box-arrow-up-right"></i> Voir la page #}
{# </a> #}
{# <button class="btn btn-outline-secondary copy-btn" data-content="sections-en"> #}
{# <i class="bi bi-clipboard"></i> Copier la liste des sections #}
{# </button> #}
{# <button class="btn btn-outline-secondary copy-btn" data-content="links-en"> #}
{# <i class="bi bi-clipboard"></i> Copier la liste des liens #}
{# </button> #}
{# </div> #}
{# </div> #}
{# </div> #}
{# </div> #}
{# <div class="col-md-6"> #}
{# <div class="card h-100"> #}
{# <div class="card-header bg-info text-white"> #}
{# <h3>Version française</h3> #}
{# <p class="mb-0"> #}
{# <small>Dernière modification: {{ fr_page.last_modified }}</small> #}
{# </p> #}
{# </div> #}
{# <div class="card-body"> #}
{# <ul class="list-group mb-3"> #}
{# <li class="list-group-item d-flex justify-content-between align-items-center"> #}
{# Sections #}
{# <span class="badge bg-info rounded-pill"> #}
{# {% if detailed_comparison.adjusted_fr_section_count is defined %} #}
{# {{ detailed_comparison.adjusted_fr_section_count }} #}
{# {% else %} #}
{# {{ fr_page.sections }} #}
{# {% endif %} #}
{# </span> #}
{# </li> #}
{# <li class="list-group-item d-flex justify-content-between align-items-center"> #}
{# Mots #}
{# <span class="badge bg-info rounded-pill">{{ fr_page.word_count }}</span> #}
{# </li> #}
{# <li class="list-group-item d-flex justify-content-between align-items-center"> #}
{# Liens #}
{# <span class="badge bg-info rounded-pill">{{ fr_page.link_count }}</span> #}
{# </li> #}
{# </ul> #}
{# <div class="d-grid gap-2"> #}
{# <a href="{{ fr_page.url }}" target="_blank" class="btn btn-outline-info"> #}
{# <i class="bi bi-box-arrow-up-right"></i> Voir la page #}
{# </a> #}
{# <button class="btn btn-outline-secondary copy-btn" data-content="sections-fr"> #}
{# <i class="bi bi-clipboard"></i> Copier la liste des sections #}
{# </button> #}
{# <button class="btn btn-outline-secondary copy-btn" data-content="links-fr"> #}
{# <i class="bi bi-clipboard"></i> Copier la liste des liens #}
{# </button> #}
{# </div> #}
{# </div> #}
{# </div> #}
{# </div> #}
{# </div> #}
{# </div> #}
{# </div> #}
<div class="mt-3">
<a href="{{ path('app_admin_wiki') }}" class="btn btn-secondary">
<i class="bi bi-arrow-left"></i> Retour à la liste des pages wiki
</a>
</div>
<div class="card mb-4">
<div class="card-header">
<h2>Comparaison des versions</h2>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-6">
<div class="card h-100">
<div class="card-header bg-primary text-white">
<h3>Version anglaise</h3>
<p class="mb-0">
<small>Dernière modification: {{ en_page.last_modified }}</small>
</p>
</div>
<div class="card-body">
<ul class="list-group mb-3">
<li class="list-group-item d-flex justify-content-between align-items-center">
Sections
<span class="badge bg-primary rounded-pill">
{% if detailed_comparison.adjusted_en_section_count is defined %}
{{ detailed_comparison.adjusted_en_section_count }}
{% else %}
{{ en_page.sections }}
{% endif %}
</span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
Mots
<span class="badge bg-primary rounded-pill">{{ en_page.word_count }}</span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
Liens
<span class="badge bg-primary rounded-pill">{{ en_page.link_count }}</span>
</li>
</ul>
<div class="d-grid gap-2">
<a href="{{ en_page.url }}" target="_blank" class="btn btn-outline-primary">
<i class="bi bi-box-arrow-up-right"></i> Voir la page
</a>
<button class="btn btn-outline-secondary copy-btn" data-content="sections-en">
<i class="bi bi-clipboard"></i> Copier la liste des sections
</button>
<button class="btn btn-outline-secondary copy-btn" data-content="links-en">
<i class="bi bi-clipboard"></i> Copier la liste des liens
</button>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<div class="card h-100">
<div class="card-header bg-info text-white">
<h3>Version française</h3>
<p class="mb-0">
<small>Dernière modification: {{ fr_page.last_modified }}</small>
</p>
</div>
<div class="card-body">
<ul class="list-group mb-3">
<li class="list-group-item d-flex justify-content-between align-items-center">
Sections
<span class="badge bg-info rounded-pill">
{% if detailed_comparison.adjusted_fr_section_count is defined %}
{{ detailed_comparison.adjusted_fr_section_count }}
{% else %}
{{ fr_page.sections }}
{% endif %}
</span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
Mots
<span class="badge bg-info rounded-pill">{{ fr_page.word_count }}</span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
Liens
<span class="badge bg-info rounded-pill">{{ fr_page.link_count }}</span>
</li>
</ul>
<div class="d-grid gap-2">
<a href="{{ fr_page.url }}" target="_blank" class="btn btn-outline-info">
<i class="bi bi-box-arrow-up-right"></i> Voir la page
</a>
<button class="btn btn-outline-secondary copy-btn" data-content="sections-fr">
<i class="bi bi-clipboard"></i> Copier la liste des sections
</button>
<button class="btn btn-outline-secondary copy-btn" data-content="links-fr">
<i class="bi bi-clipboard"></i> Copier la liste des liens
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Hidden content for copy functionality -->

View file

@ -0,0 +1,325 @@
{% extends 'base.html.twig' %}
{% block title %}Évolution des scores de décrépitude - Wiki OSM{% endblock %}
{% block body %}
<div class="container mt-4">
{% include 'admin/_wiki_navigation.html.twig' %}
<h1>Évolution des scores de décrépitude</h1>
<p class="lead">
Cette page montre l'évolution des scores de décrépitude des pages wiki OpenStreetMap en français par rapport aux versions anglaises.
<a href="https://forum.openstreetmap.fr/t/fabriquer-un-outil-de-qualite-pour-le-wiki-osm/36814">
Venez discuter QualiWiki sur le forum
</a>
</p>
{% if not json_exists %}
<div class="alert alert-warning">
<h4 class="alert-heading">Données manquantes</h4>
<p>Le fichier JSON contenant les données de décrépitude n'existe pas. Vous pouvez le générer en exécutant le script Python suivant :</p>
<pre class="bg-light p-3 rounded"><code>cd {{ app.request.server.get('DOCUMENT_ROOT')|replace({'/public': ''}) }}/wiki_compare
python3 wiki_compare.py</code></pre>
<p>Ce script va analyser les pages wiki et générer les fichiers nécessaires, y compris le fichier <code>outdated_pages.json</code> et l'histogramme.</p>
</div>
{% else %}
{% if last_updated %}
<div class="alert alert-info">
<p>Dernière mise à jour des données : {{ last_updated|date('d/m/Y H:i:s') }}</p>
</div>
{% endif %}
{% if histogram_exists %}
<div class="card mb-4">
<div class="card-header">
<h2>Histogramme des scores de décrépitude</h2>
</div>
<div class="card-body text-center">
<img src="{{ asset('wiki_compare/staleness_histogram.png') }}" alt="Histogramme des scores de décrépitude" class="img-fluid">
</div>
</div>
{% endif %}
<div class="card mb-4">
<div class="card-header">
<h2>Évolution des scores de décrépitude</h2>
</div>
<div class="card-body">
<p>Le score de décrépitude est calculé en prenant en compte plusieurs facteurs :</p>
<ul>
<li>La différence de date entre les versions anglaise et française (20%)</li>
<li>La différence de nombre de mots entre les versions (50%)</li>
<li>La différence de nombre de sections entre les versions (15%)</li>
<li>La différence de nombre de liens entre les versions (15%)</li>
</ul>
<p>Plus le score est élevé, plus la page française est considérée comme "décrépite" par rapport à sa version anglaise.</p>
<canvas id="decrepitudeChart" height="300"></canvas>
</div>
</div>
<div class="card mb-4">
<div class="card-header bg-warning text-dark">
<h2>Pages régulières avec les scores de décrépitude les plus élevés</h2>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead class="thead-dark">
<tr>
<th>Clé</th>
<th>Raison</th>
<th>Différence de mots</th>
<th>Différence de sections</th>
<th>Différence de liens</th>
<th>Score de décrépitude</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for page in regular_pages|slice(0, 20) %}
<tr>
<td><strong>{{ page.key }}</strong></td>
<td>{{ page.reason }}</td>
<td class="text-center">
{% if page.word_diff > 0 %}
<span class="badge bg-danger">{{ page.word_diff }}</span>
{% elseif page.word_diff < 0 %}
<span class="badge bg-success">{{ page.word_diff }}</span>
{% else %}
<span class="badge bg-secondary">0</span>
{% endif %}
</td>
<td class="text-center">
{% if page.section_diff > 0 %}
<span class="badge bg-danger">{{ page.section_diff }}</span>
{% elseif page.section_diff < 0 %}
<span class="badge bg-success">{{ page.section_diff }}</span>
{% else %}
<span class="badge bg-secondary">0</span>
{% endif %}
</td>
<td class="text-center">
{% if page.link_diff > 0 %}
<span class="badge bg-danger">{{ page.link_diff }}</span>
{% elseif page.link_diff < 0 %}
<span class="badge bg-success">{{ page.link_diff }}</span>
{% else %}
<span class="badge bg-secondary">0</span>
{% endif %}
</td>
<td class="text-center">
<div class="progress" style="height: 20px;">
{% set score_class = page.staleness_score > 70 ? 'bg-danger' : (page.staleness_score > 40 ? 'bg-warning' : 'bg-success') %}
<div class="progress-bar {{ score_class }}" role="progressbar"
style="width: {{ page.staleness_score }}%;"
aria-valuenow="{{ page.staleness_score }}"
aria-valuemin="0"
aria-valuemax="100">
{{ page.staleness_score }}
</div>
</div>
</td>
<td class="text-center">
<div class="btn-group" role="group">
<a href="{{ page.en_page.url }}" target="_blank"
class="btn btn-sm btn-outline-primary" title="Version anglaise">
<i class="bi bi-translate"></i> EN
</a>
{% if page.fr_page %}
<a href="{{ page.fr_page.url }}" target="_blank"
class="btn btn-sm btn-outline-info" title="Version française">
<i class="bi bi-translate"></i> FR
</a>
<a href="{{ path('app_admin_wiki_compare', {'key': page.key}) }}"
class="btn btn-sm btn-outline-secondary"
title="Comparer les versions">
<i class="bi bi-arrows-angle-expand"></i> Comparer
</a>
{% else %}
<a href="{{ path('app_admin_wiki_create_french', {'key': page.key}) }}"
class="btn btn-sm btn-success"
title="Créer une traduction française">
<i class="bi bi-plus-circle"></i> Traduire
</a>
{% endif %}
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% if specific_pages|length > 0 %}
<div class="card mb-4">
<div class="card-header bg-primary text-white">
<h2>Pages spécifiques avec scores de décrépitude ({{ specific_pages|length }})</h2>
</div>
<div class="card-body">
<p>Ces pages wiki sont des pages spécifiques qui ont été sélectionnées pour une comparaison particulière.</p>
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead class="thead-dark">
<tr>
<th>Titre</th>
<th>Raison</th>
<th>Score de décrépitude</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for page in specific_pages %}
<tr>
<td>
<div class="d-flex align-items-center">
{% if page.en_page.description_img_url is defined and page.en_page.description_img_url %}
<div class="me-3">
<img src="{{ page.en_page.description_img_url }}"
alt="{{ page.key }}"
style="max-width: 80px; max-height: 60px; object-fit: contain;">
</div>
{% endif %}
<div>
<strong>{{ page.key }}</strong>
</div>
</div>
</td>
<td>
{{ page.reason }}
</td>
<td>
<div class="progress" style="height: 20px;">
{% set score_class = page.staleness_score > 70 ? 'bg-danger' : (page.staleness_score > 40 ? 'bg-warning' : 'bg-success') %}
<div class="progress-bar {{ score_class }}" role="progressbar"
style="width: {{ page.staleness_score }}%;"
aria-valuenow="{{ page.staleness_score }}"
aria-valuemin="0"
aria-valuemax="100">
{{ page.staleness_score }}
</div>
</div>
</td>
<td class="text-center">
<div class="btn-group" role="group">
<a href="{{ page.en_page.url }}" target="_blank"
class="btn btn-sm btn-outline-primary" title="Version anglaise">
<i class="bi bi-translate"></i> EN
</a>
{% if page.fr_page %}
<a href="{{ page.fr_page.url }}" target="_blank"
class="btn btn-sm btn-outline-info" title="Version française">
<i class="bi bi-translate"></i> FR
</a>
<a href="{{ path('app_admin_wiki_compare', {'key': page.key}) }}"
class="btn btn-sm btn-outline-secondary"
title="Comparer les versions">
<i class="bi bi-arrows-angle-expand"></i> Comparer
</a>
{% else %}
<a href="{{ path('app_admin_wiki_create_french', {'key': page.key}) }}"
class="btn btn-sm btn-success"
title="Créer une traduction française">
<i class="bi bi-plus-circle"></i> Traduire
</a>
{% endif %}
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endif %}
{% endif %}
</div>
{% endblock %}
{% block javascripts %}
{{ parent() }}
{% if json_exists %}
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function () {
// Collect data for the chart
const labels = [];
const scores = [];
const colors = [];
{% for page in regular_pages|slice(0, 20) %}
labels.push("{{ page.key }}");
scores.push({{ page.staleness_score }});
// Set color based on score
{% if page.staleness_score > 80 %}
colors.push('rgba(220, 53, 69, 0.7)'); // danger (red)
{% elseif page.staleness_score > 60 %}
colors.push('rgba(232, 113, 55, 0.7)'); // dark orange
{% elseif page.staleness_score > 40 %}
colors.push('rgba(255, 153, 0, 0.7)'); // orange
{% elseif page.staleness_score > 20 %}
colors.push('rgba(255, 193, 7, 0.7)'); // warning (yellow)
{% elseif page.staleness_score > 10 %}
colors.push('rgba(140, 195, 38, 0.7)'); // light green
{% else %}
colors.push('rgba(25, 135, 84, 0.7)'); // success (green)
{% endif %}
{% endfor %}
// Sort data by score (descending)
const indices = Array.from(Array(scores.length).keys())
.sort((a, b) => scores[b] - scores[a]);
const sortedLabels = indices.map(i => labels[i]);
const sortedScores = indices.map(i => scores[i]);
const sortedColors = indices.map(i => colors[i]);
// Create the chart
const ctx = document.getElementById('decrepitudeChart').getContext('2d');
new Chart(ctx, {
type: 'bar',
data: {
labels: sortedLabels,
datasets: [{
label: 'Score de décrépitude',
data: sortedScores,
backgroundColor: sortedColors,
borderColor: sortedColors.map(c => c.replace('0.7', '1')),
borderWidth: 1
}]
},
options: {
indexAxis: 'y',
responsive: true,
plugins: {
legend: {
display: false
},
tooltip: {
callbacks: {
label: function (context) {
return `Score: ${context.raw}`;
}
}
}
},
scales: {
x: {
beginAtZero: true,
max: 100,
title: {
display: true,
text: 'Score de décrépitude (0-100)'
}
}
}
}
});
});
</script>
{% endif %}
{% endblock %}

View file

@ -40,7 +40,7 @@
<a href="{{ page.url }}" target="_blank" class="btn btn-sm btn-outline-info" title="Version française">
<i class="bi bi-translate"></i> FR
</a>
<a href="https://wiki.openstreetmap.org/wiki/{{ page.key }}" target="_blank" class="btn btn-sm btn-success" title="Créer la version anglaise">
<a href="https://wiki.openstreetmap.org/w/index.php?title={{ page.key }}&action=edit" target="_blank" class="btn btn-sm btn-success" title="Créer la version anglaise">
<i class="bi bi-plus-circle"></i> Créer EN
</a>
</div>

View file

@ -93,7 +93,7 @@
<p>Vous pouvez contribuer en créant cette page sur le wiki OpenStreetMap.</p>
</div>
<div class="d-grid gap-2">
<a href="https://wiki.openstreetmap.org/w/index.php?title=FR:Key:{{ page.key }}&action=edit"
<a href="https://wiki.openstreetmap.org/w/index.php?title=FR:{{ page.key }}&action=edit"
target="_blank" class="btn btn-success">
<i class="bi bi-plus-circle"></i> Créer la page française
</a>