-
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): ajout de la vue historique des visiteurs mensuels (#656)
## Description 🎸 Ajout de la vue historique des visiteurs mensuels, en complément du funnel de la vue `statistiques` 🎸 Ajout des liens de navigation entre la vue `monthly_visitors` et la vue `statistiques` ## Type de changement 🎢 Nouvelle fonctionnalité (changement non cassant qui ajoute une fonctionnalité). ### Captures d'écran (optionnel) ![image](https://github.com/gip-inclusion/itou-communaute-django/assets/11419273/5d37676d-1c0f-492d-8455-fa06bf6c91fc) lien cliquable sur la page statistiques principale ![image](https://github.com/gip-inclusion/itou-communaute-django/assets/11419273/88cc0e45-f810-4f5c-9e91-e9e561985de7)
- Loading branch information
1 parent
6f3049a
commit 804be3c
Showing
5 changed files
with
168 additions
and
3 deletions.
There are no files selected for viewing
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,8 +1,11 @@ | ||
from django.urls import path | ||
|
||
from lacommunaute.forum_stats.views import StatistiquesPageView | ||
from lacommunaute.forum_stats.views import MonthlyVisitorsViews, StatistiquesPageView | ||
|
||
|
||
app_name = "forum_stats" | ||
|
||
urlpatterns = [path("", StatistiquesPageView.as_view(), name="statistiques")] | ||
urlpatterns = [ | ||
path("", StatistiquesPageView.as_view(), name="statistiques"), | ||
path("monthly-visitors/", MonthlyVisitorsViews.as_view(), name="monthly_visitors"), | ||
] |
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,80 @@ | ||
{% extends "layouts/base.html" %} | ||
{% load str_filters %} | ||
{% 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> | ||
<script nonce="{{ request.csp_nonce }}"> | ||
const ctx_stats = document.getElementById('statChart'); | ||
new Chart(ctx_stats, { | ||
type: 'line', | ||
data: { | ||
labels: {{ monthly_visitors.date | js }}, | ||
datasets: [ | ||
{ | ||
label: 'Utilisateurs', | ||
data: {{ monthly_visitors.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 }}, | ||
borderColor: 'rgba(76, 120, 83)', | ||
backgroundColor: 'rgba(112, 178, 123)', | ||
}, | ||
{ | ||
label: 'Utilisateurs engagés', | ||
data: {{ monthly_visitors.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 }}, | ||
borderColor: 'rgba(98, 42, 86)', | ||
backgroundColor: 'rgba(155, 67, 136)', | ||
}, | ||
] | ||
}, | ||
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