-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(stats): afficher les stats quotidiennes des Diagnostics Parcours…
… IAE (#660) ## Description 🎸 Afficher dans la page `statistiques`, le nombre de `dsp` généré depuis le lancement de l'expé 🎸 Afficher à partir de la page `statistiques`, le graphe de nombre de `dsp` quotidiens sur les 3 derniers mois ## Type de changement 🎢 Nouvelle fonctionnalité (changement non cassant qui ajoute une fonctionnalité). ### Points d'attention 🦺 mutualisation de la génération des vues de détails et de leur templates avec `MonthlyVisitorsView` ### Captures d'écran (optionnel) vue de la page `statistique` ![image](https://github.com/gip-inclusion/itou-communaute-django/assets/11419273/012d0c94-dce4-478c-9b72-a9a3d19f5b7a) vue de la page de détail ![image](https://github.com/gip-inclusion/itou-communaute-django/assets/11419273/0bc25d9e-9281-49aa-b898-505cbaa1e935) --------- Co-authored-by: hellodeloo <[email protected]>
- Loading branch information
1 parent
bb341cb
commit 5c74c56
Showing
8 changed files
with
216 additions
and
61 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
lacommunaute/forum_stats/tests/__snapshots__/tests_views.ambr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# serializer version: 1 | ||
# name: TestDailyDSPView.test_navigation[breadcrumb] | ||
''' | ||
<nav aria-label="Fil d'ariane" class="c-breadcrumb"> | ||
<ol class="breadcrumb"> | ||
<li class="breadcrumb-item">Retourner vers</li> | ||
<li class="breadcrumb-item"> | ||
<a href="/statistiques/">Statistiques</a> | ||
</li> | ||
</ol> | ||
</nav> | ||
''' | ||
# --- | ||
# name: TestMonthlyVisitorsView.test_navigation[breadcrumb] | ||
''' | ||
<nav aria-label="Fil d'ariane" class="c-breadcrumb"> | ||
<ol class="breadcrumb"> | ||
<li class="breadcrumb-item">Retourner vers</li> | ||
<li class="breadcrumb-item"> | ||
<a href="/statistiques/">Statistiques</a> | ||
</li> | ||
</ol> | ||
</nav> | ||
''' | ||
# --- | ||
# name: TestStatistiquesPageView.test_dsp_count[dsp] | ||
''' | ||
<div class="s-section__row row" id="daily_dsp"> | ||
<div class="s-section__col col-12"> | ||
<div class="c-box mb-3 mb-md-5"> | ||
<h2>10 Diagnostiques Parcours IAE</h2> | ||
<p> | ||
Réalisés sur la communauté de l'inclusion depuis le 24 février 2024 | ||
<span class="fs-sm">(<a href="/statistiques/dsp/">Voir les détails</a>)</span> | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
''' | ||
# --- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
from django.urls import path | ||
|
||
from lacommunaute.forum_stats.views import MonthlyVisitorsView, StatistiquesPageView | ||
from lacommunaute.forum_stats.views import DailyDSPView, MonthlyVisitorsView, StatistiquesPageView | ||
|
||
|
||
app_name = "forum_stats" | ||
|
||
urlpatterns = [ | ||
path("", StatistiquesPageView.as_view(), name="statistiques"), | ||
path("monthly-visitors/", MonthlyVisitorsView.as_view(), name="monthly_visitors"), | ||
path("dsp/", DailyDSPView.as_view(), name="dsp"), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{% extends "layouts/base.html" %} | ||
{% load str_filters %} | ||
{% load static %} | ||
{% load i18n %} | ||
{% block title %}Statistiques{{ block.super }}{% endblock %} | ||
{% block body_class %}p-statistiques{{ block.super }}{% endblock %} | ||
{% block breadcrumb %} | ||
<div class="container"> | ||
<nav class="c-breadcrumb" aria-label="Fil d'ariane"> | ||
<ol class="breadcrumb"> | ||
<li class="breadcrumb-item">{% trans "Back to" %}</li> | ||
<li class="breadcrumb-item"> | ||
<a href="{% url 'forum_stats:statistiques' %}">Statistiques</a> | ||
</li> | ||
</ol> | ||
</nav> | ||
</div> | ||
{% endblock %} | ||
{% block content %} | ||
<section class="s-title-01 mt-lg-5"> | ||
<div class="s-title-01__container container"> | ||
<div class="s-title-01__row row"> | ||
<div class="s-title-01__col col-12"> | ||
<h1 class="s-title-01__title h1"> | ||
<strong>Statistiques</strong> | ||
</h1> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
<section class="s-section"> | ||
<div class="s-section__container container"> | ||
<div class="s-section__row row"> | ||
<div class="s-section__col col-12"> | ||
<div class="c-box mb-3 mb-md-5"> | ||
<h2>{{ box_title }}</h2> | ||
<canvas id="statChart"></canvas> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
{% endblock %} | ||
{% block extra_js %}{{ block.super }}{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{% extends "./base_detail_stats.html" %} | ||
{% load js_filters %} | ||
{% block extra_js %} | ||
{{ block.super }} | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script> | ||
<script nonce="{{ request.csp_nonce }}"> | ||
const ctx_stats = document.getElementById('statChart'); | ||
new Chart(ctx_stats, { | ||
type: 'line', | ||
data: { | ||
labels: {{ stats.date | js }}, | ||
datasets: [ | ||
{ | ||
label: 'Diagnostics Parcours IAE', | ||
data: {{ stats.dsp | js }}, | ||
borderColor: 'rgba(54, 162, 235)', | ||
backgroundColor: 'rgba(154, 208, 245)', | ||
}, | ||
|
||
] | ||
}, | ||
options: { | ||
responsive:true, | ||
cubicInterpolationMode: 'monotone', | ||
tension: 0.4, | ||
} | ||
}); | ||
</script> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,5 @@ | ||
{% extends "layouts/base.html" %} | ||
{% load str_filters %} | ||
{% extends "./base_detail_stats.html" %} | ||
{% load js_filters %} | ||
{% load static %} | ||
{% block title %}Statistiques{{ block.super }}{% endblock %} | ||
{% block body_class %}p-statistiques{{ block.super }}{% endblock %} | ||
{% block content %} | ||
<section class="s-title-01 mt-lg-5"> | ||
<div class="s-title-01__container container"> | ||
<div class="s-title-01__row row"> | ||
<div class="s-title-01__col col-12"> | ||
<h1 class="s-title-01__title h1"> | ||
<strong>Statistiques</strong> | ||
</h1> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
<section class="s-section"> | ||
<div class="s-section__container container"> | ||
<div class="s-section__row row"> | ||
<div class="s-section__col col-12"> | ||
<div class="c-box mb-3 mb-md-5"> | ||
<h2>Utilisateurs uniques mensuels</h2> | ||
<canvas id="statChart"></canvas> | ||
<p class="mt-1"> | ||
<small> | ||
<a href="{% url 'forum_stats:statistiques' %}">retour vers la page statistiques</a> | ||
</small> | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
{% endblock %} | ||
{% block extra_js %} | ||
{{ block.super }} | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script> | ||
|
@@ -42,29 +8,29 @@ <h2>Utilisateurs uniques mensuels</h2> | |
new Chart(ctx_stats, { | ||
type: 'line', | ||
data: { | ||
labels: {{ monthly_visitors.date | js }}, | ||
labels: {{ stats.date | js }}, | ||
datasets: [ | ||
{ | ||
label: 'Utilisateurs', | ||
data: {{ monthly_visitors.nb_uniq_visitors | js }}, | ||
data: {{ stats.nb_uniq_visitors | js }}, | ||
borderColor: 'rgba(54, 162, 235)', | ||
backgroundColor: 'rgba(154, 208, 245)', | ||
}, | ||
{ | ||
label: 'Utilisateurs actifs', | ||
data: {{ monthly_visitors.nb_uniq_active_visitors | js }}, | ||
data: {{ stats.nb_uniq_active_visitors | js }}, | ||
borderColor: 'rgba(76, 120, 83)', | ||
backgroundColor: 'rgba(112, 178, 123)', | ||
}, | ||
{ | ||
label: 'Utilisateurs engagés', | ||
data: {{ monthly_visitors.nb_uniq_engaged_visitors | js }}, | ||
data: {{ stats.nb_uniq_engaged_visitors | js }}, | ||
borderColor: 'rgba(255, 159, 64)', | ||
backgroundColor: 'rgba(255, 207, 159)', | ||
}, | ||
{ | ||
label: 'Utilisateurs retour', | ||
data: {{ monthly_visitors.nb_uniq_visitors_returning | js }}, | ||
data: {{ stats.nb_uniq_visitors_returning | js }}, | ||
borderColor: 'rgba(98, 42, 86)', | ||
backgroundColor: 'rgba(155, 67, 136)', | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters