changeset a9e69037875a in bugs.tryton.org:default
details: https://hg.tryton.org/bugs.tryton.org?cmd=changeset&node=a9e69037875a
description:
Add statistics graphic
diffstat:
html/layout/navigation.html | 4 ++++
issue-stats.sql | 5 +++++
static/graph/issue.html | 40 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 49 insertions(+), 0 deletions(-)
diffs (67 lines):
diff -r 5836951eec59 -r a9e69037875a html/layout/navigation.html
--- a/html/layout/navigation.html Tue Jul 20 11:12:12 2021 +0200
+++ b/html/layout/navigation.html Sun Sep 05 01:01:19 2021 +0200
@@ -47,6 +47,10 @@
</div>
</form>
</li>
+ <li class="nav-item">
+ <a href="@@file/graph/issue.html">{% trans %}Statistics{% endtrans
%}</a>
+ </li>
+ </li>
</ul>
<hr>
{% else %}
diff -r 5836951eec59 -r a9e69037875a issue-stats.sql
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/issue-stats.sql Sun Sep 05 01:01:19 2021 +0200
@@ -0,0 +1,5 @@
+SELECT CAST(date AS DATE), SUM(new) AS new, SUM(resolved) AS resolve FROM (
+ SELECT DATE_TRUNC('month', _activity) AS date, 0 as new, 1 AS resolved
FROM _issue WHERE _status <= 7
+ UNION ALL
+ SELECT DATE_TRUNC('month', _creation) AS date, 1 as new, 0 as resolved
FROM _issue) AS report
+GROUP BY date ORDER BY date DESC;
diff -r 5836951eec59 -r a9e69037875a static/graph/issue.html
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/static/graph/issue.html Sun Sep 05 01:01:19 2021 +0200
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Statistics of Tryton's issues</title>
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/c3/c3.css">
+ <script
src="https://cdn.jsdelivr.net/npm/d3@5/dist/d3.min.js"></script>
+ <script src="https://cdn.jsdelivr.net/npm/c3/c3.min.js"></script>
+ </head>
+ <body>
+ <h1 style="text-align: center;">Statistics of Tryton's issues</h1>
+ <div id="chart" style="max-width: 1200px; margin: auto;"></div>
+ <script>
+ var chart = c3.generate({
+ bindto: '#chart',
+ data: {
+ url: 'issue.csv',
+ x: 'date',
+ type: 'spline',
+ },
+ axis: {
+ x: {
+ type: 'timeseries',
+ tick: {
+ format: '%Y-%m-%d',
+ }
+ },
+ y: {
+ padding: 0,
+ },
+ },
+ grid: {
+ y: {
+ show: true,
+ },
+ },
+ });
+ </script>
+ </body>
+</html>