From d2bd113ab8c17e67c98c34b379b1b1cf256f4a49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Wed, 25 Nov 2020 15:27:34 +0100 Subject: [PATCH] chg: Cleanup on stats page --- website/web/__init__.py | 8 ++++ website/web/templates/stats.html | 71 +++++++++++++++++++------------- 2 files changed, 51 insertions(+), 28 deletions(-) diff --git a/website/web/__init__.py b/website/web/__init__.py index 5540018..8a13926 100644 --- a/website/web/__init__.py +++ b/website/web/__init__.py @@ -9,6 +9,7 @@ from pathlib import Path from datetime import datetime, timedelta import json import http +import calendar from flask import Flask, render_template, request, send_file, redirect, url_for, Response, flash, jsonify from flask_bootstrap import Bootstrap # type: ignore @@ -80,6 +81,13 @@ def http_status_description(code: int): app.jinja_env.globals.update(http_status_description=http_status_description) +def month_name(month: int): + return calendar.month_name[month] + + +app.jinja_env.globals.update(month_name=month_name) + + # ##### Generic/configuration methods ##### @app.after_request diff --git a/website/web/templates/stats.html b/website/web/templates/stats.html index b14c314..550d347 100644 --- a/website/web/templates/stats.html +++ b/website/web/templates/stats.html @@ -6,8 +6,10 @@ {% block content %}
{% for weeks in stats['weeks'] %} -

Week : {{ weeks['week'] }}

+

Week: {{ weeks['week'] }}

+
+ @@ -15,43 +17,56 @@ + + - - - - - + + + + + -
Submissions Submissions with redirectsUniq urls Uniq domains
{{ weeks['analysis'] }} {{ weeks['analysis_with_redirects'] }} {{ weeks['redirects'] }} {{ weeks['uniq_urls'] }} {{ weeks['uniq_domains'] }} {{ weeks['analysis'] }} {{ weeks['analysis_with_redirects'] }} {{ weeks['redirects'] }} {{ weeks['uniq_urls'] }} {{ weeks['uniq_domains'] }}
-
+ +
+
{% endfor %}
-{% for name,dict_ in stats['years'].items() %} -

Year : {{ name }} - Analysis : {{ dict_['yearly_analysis']}} - Redirects : {{ dict_['yearly_redirects'] }}

+{% for name, dict_ in stats['years'].items() %} +

Year: {{ name }}

+
- {% for monthnumber,month in dict_.items() %} + {% for monthnumber, month in dict_.items() %} {% if monthnumber is number %} -

{{ monthnumber }}

+

{{ month_name(monthnumber) }}

+
- - - - - - - - - - - - - - -
SubmissionsSubmissions with redirectsRedirectsUniq urlsUniq domains
{{ month['analysis'] }} {{ month['analysis_with_redirects'] }} {{ month['redirects'] }} {{ month['uniq_urls'] }} {{ month['uniq_domains'] }}
+ + + + + + + + + + + + + + + + + + +
SubmissionsSubmissions with redirectsRedirectsUniq urlsUniq domains
{{ month['analysis'] }} {{ month['analysis_with_redirects'] }} {{ month['redirects'] }} {{ month['uniq_urls'] }} {{ month['uniq_domains'] }}
+
{% endif %} - {% endfor %} + {% endfor %}
{% endfor %}