-
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): page de statistique des fiches pratiques (#796)
## Description 🎸 Vue `DocumentStats` pour afficher le temps de lecture cumulé, le nombre de visites, le nombre de notation et la moyenne de notations, de toutes les fiches pratiques. ## Type de changement 🎢 Nouvelle fonctionnalité (changement non cassant qui ajoute une fonctionnalité). ### Points d'attention 🦺 les annotations de `ForumStats` et `ForumRating` sont associées via une `SubQuery` 🦺 ajout du templatetag `convert_seconds_into_hours` 🦺 mise à jour de la factory `ForumStatFactory` pour déterminer les valeurs de `visits`, `entry_visits` et `time_spent` 🦺 tri des items par le passage d'un param `sort` dans l'url ### Captures d'écran (optionnel) page avec tri par défaut ![image](https://github.com/user-attachments/assets/edb499cd-aebb-4479-baad-65833bcfbc0a) page avec tri sur le nombre de visites ![image](https://github.com/user-attachments/assets/72442619-77fe-4dd6-b67d-42344fa478c8) bas de la page statistiques avec le lien vers la nouvelle vue ![image](https://github.com/user-attachments/assets/bc14e223-be76-46f9-ae05-aab7dee51da4)
- Loading branch information
1 parent
c830f0a
commit 41237f1
Showing
9 changed files
with
1,038 additions
and
8 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
834 changes: 834 additions & 0 deletions
834
lacommunaute/stats/tests/__snapshots__/tests_views.ambr
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,78 @@ | ||
{% extends "layouts/base.html" %} | ||
{% load static %} | ||
{% load i18n %} | ||
{% load date_filters %} | ||
{% load str_filters %} | ||
{% block title %}Statistiques des Fiches Pratiques{{ 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 '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">Statistiques des fiches pratiques</h1> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
<section class="s-section"> | ||
<div class="s-section__container container"> | ||
<div class="s-section__row row" id="most_rated"> | ||
<div class="s-section__col col-12"> | ||
<div class="c-box mb-3 mb-md-5"> | ||
<table class="table"> | ||
<caption>Sont présentes dans ce tableau, les fiches pratiques de l'espace Documents. | ||
<br> | ||
Le nombre et la moyenne des notations sont calculés en temps réel. | ||
<br> | ||
Le nombre de visites et le cumul du temps de lecture est calculé hebdomadairement, chaque lundi matin. | ||
</caption> | ||
{% with sort_fields=sort_fields %} | ||
<thead> | ||
<tr> | ||
<th scope="col">Fiche Pratique</th> | ||
{% for field in sort_fields %} | ||
<th scope="col"> | ||
<a href="{{ request.path }}?sort={{ field.key }}" class="text-decoration-none"> | ||
{{ field.label }} | ||
{% if sort_key == field.key %}<i class="ri-arrow-down-s-fill"></i>{% endif %} | ||
</a> | ||
</th> | ||
{% endfor %} | ||
</tr> | ||
</thead> | ||
{% endwith %} | ||
<tbody> | ||
{% for obj in objects %} | ||
<tr> | ||
<th scope="row"> | ||
<a href="{{ obj.absolute_url }}">{{ obj.name }}</a> | ||
<br> | ||
{% if obj.partner %}<span class="text-muted">en partenariat avec {{ obj.partner.name }}</span>{% endif %} | ||
</th> | ||
<td>{{ obj.sum_time_spent|convert_seconds_into_hours }}</td> | ||
<td>{{ obj.sum_visits }}</td> | ||
<td>{{ obj.count_rating|default_if_none:"pas de notation" }}</td> | ||
<td>{{ obj.avg_rating|floatformat:2 }}</td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
{% 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
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