From cf7928a132554559f7868d31fdf02b1327f442cc Mon Sep 17 00:00:00 2001 From: Bart P Date: Wed, 24 Jan 2024 19:03:19 +0100 Subject: [PATCH 1/6] Add decimals --- web/templates/dashboard/index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/templates/dashboard/index.html b/web/templates/dashboard/index.html index 04ab94d3fa1..04930fba9bc 100644 --- a/web/templates/dashboard/index.html +++ b/web/templates/dashboard/index.html @@ -2,19 +2,19 @@ {% block content %}
- Estimating ~{{report.estimate_hour}} analysis per hour, {{report.estimate_day}} per day. + Estimating ~{{report.estimate_hour|stringformat:",d"}} analysis per hour, {{report.estimate_day|stringformat:",d"}} per day.
-

{{report.total_tasks}}

+

{{report.total_tasks|stringformat:",d"}}

Total tasks
-

{{report.total_samples}}

+

{{report.total_samples|stringformat:",d"}}

Total samples
From 45bea6c441984bfda748ce3b91bd88aaec660521 Mon Sep 17 00:00:00 2001 From: doomedraven Date: Fri, 8 Mar 2024 21:49:12 +0100 Subject: [PATCH 2/6] Update views.py --- web/dashboard/views.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/dashboard/views.py b/web/dashboard/views.py index 5593a98315e..da5595cd0f0 100644 --- a/web/dashboard/views.py +++ b/web/dashboard/views.py @@ -46,7 +46,11 @@ def index(request): db = Database() report = dict( - total_samples=db.count_samples(), total_tasks=db.count_tasks(), states_count={}, estimate_hour=None, estimate_day=None + total_samples=f"{db.count_samples():,}", + total_tasks=f"{db.count_tasks():,}", + states_count={}, + estimate_hour=None, + estimate_day=None ) states = ( From 5a9b85fbeefc0150c09734d7c53ac74ebe78feb1 Mon Sep 17 00:00:00 2001 From: doomedraven Date: Fri, 8 Mar 2024 21:50:20 +0100 Subject: [PATCH 3/6] Update index.html --- web/templates/dashboard/index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/templates/dashboard/index.html b/web/templates/dashboard/index.html index 04930fba9bc..fac39647f5b 100644 --- a/web/templates/dashboard/index.html +++ b/web/templates/dashboard/index.html @@ -2,19 +2,19 @@ {% block content %}
- Estimating ~{{report.estimate_hour|stringformat:",d"}} analysis per hour, {{report.estimate_day|stringformat:",d"}} per day. + Estimating ~{{report.estimate_hour}} analysis per hour, {{report.estimate_day}} per day.
-

{{report.total_tasks|stringformat:",d"}}

+

{{report.total_tasks"}}

Total tasks
-

{{report.total_samples|stringformat:",d"}}

+

{{report.total_samples"}}

Total samples
From 03be55f2f4fe82a610c4571018d68ea5c2de4243 Mon Sep 17 00:00:00 2001 From: doomedraven Date: Fri, 8 Mar 2024 21:51:19 +0100 Subject: [PATCH 4/6] Update index.html --- web/templates/dashboard/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/templates/dashboard/index.html b/web/templates/dashboard/index.html index fac39647f5b..04ab94d3fa1 100644 --- a/web/templates/dashboard/index.html +++ b/web/templates/dashboard/index.html @@ -8,13 +8,13 @@
-

{{report.total_tasks"}}

+

{{report.total_tasks}}

Total tasks
-

{{report.total_samples"}}

+

{{report.total_samples}}

Total samples
From 82a9a7f10b1f0b5e8fc868055082bb4a8bace714 Mon Sep 17 00:00:00 2001 From: doomedraven Date: Sat, 9 Mar 2024 07:25:27 +0100 Subject: [PATCH 5/6] Update views.py --- web/dashboard/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/dashboard/views.py b/web/dashboard/views.py index da5595cd0f0..e5f184032b5 100644 --- a/web/dashboard/views.py +++ b/web/dashboard/views.py @@ -46,8 +46,8 @@ def index(request): db = Database() report = dict( - total_samples=f"{db.count_samples():,}", - total_tasks=f"{db.count_tasks():,}", + total_samples=f"{db.count_samples():,}".replace(',',' '), + total_tasks=f"{db.count_tasks():,}".replace(',',' '), states_count={}, estimate_hour=None, estimate_day=None From 75de6c928df67410a78b16b6f0501be8281af7b5 Mon Sep 17 00:00:00 2001 From: doomedraven Date: Sat, 9 Mar 2024 07:29:55 +0100 Subject: [PATCH 6/6] Update views.py --- web/dashboard/views.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/web/dashboard/views.py b/web/dashboard/views.py index e5f184032b5..32cc0bb8b2e 100644 --- a/web/dashboard/views.py +++ b/web/dashboard/views.py @@ -40,14 +40,17 @@ def __call__(self, func): return self.decorator(func) +def format_number_with_space(number): + return f"{number:,}".replace(',',' ') + @require_safe @conditional_login_required(login_required, settings.WEB_AUTHENTICATION) def index(request): db = Database() report = dict( - total_samples=f"{db.count_samples():,}".replace(',',' '), - total_tasks=f"{db.count_tasks():,}".replace(',',' '), + total_samples=format_number_with_space(db.count_samples()), + total_tasks=format_number_with_space(db.count_tasks()), states_count={}, estimate_hour=None, estimate_day=None @@ -83,8 +86,8 @@ def index(request): else: hourly = 0 - report["estimate_hour"] = int(hourly) - report["estimate_day"] = int(24 * hourly) + report["estimate_hour"] = format_number_with_space(int(hourly)) + report["estimate_day"] = format_number_with_space(int(24 * hourly)) report["top_detections"] = top_detections() return render(request, "dashboard/index.html", {"report": report})