From c139886c61b95e93b65faa03691bf2dcda9da7c1 Mon Sep 17 00:00:00 2001 From: relikd Date: Tue, 15 Sep 2020 20:34:55 +0200 Subject: [PATCH] Fix IP address part of domain --- src/bundle_combine.py | 2 ++ src/html_bundle.py | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/bundle_combine.py b/src/bundle_combine.py index ce10cb2..131a9ab 100755 --- a/src/bundle_combine.py +++ b/src/bundle_combine.py @@ -23,6 +23,8 @@ def get_parent_domain(subdomain): parts = subdomain.split('.') if len(parts) < 3: return subdomain + elif parts[-1].isdigit(): + return subdomain # ip address elif dom_in_3rd_domain(parts[-1] + '.' + parts[-2]): return '.'.join(parts[-3:]) else: diff --git a/src/html_bundle.py b/src/html_bundle.py index dd7de72..dd3247a 100755 --- a/src/html_bundle.py +++ b/src/html_bundle.py @@ -14,6 +14,10 @@ def seconds_to_time(seconds): return '{:02d}:{:02d}:{:02d}'.format(hours, minutes, seconds) +def round_num(num): + return format(num, '.1f') # .rstrip('0').rstrip('.') + + def gen_dotgraph(sorted_arr): txt = '' for name, count, mark in sorted_arr: @@ -94,10 +98,10 @@ def gen_html(bundle_id, obj): Number of recordings:{ obj['sum_rec'] } Total number of requests:{ obj['sum_logs'] }({ - round(obj['sum_logs_pm'], 1)} / min) + round_num(obj['sum_logs_pm'])} / min) Average number of requests:{ - round(obj['avg_logs'], 1)}({ - round(obj['avg_logs_pm'], 1)} / min) + round_num(obj['avg_logs'])}({ + round_num(obj['avg_logs_pm'])} / min) Average recording time:{ seconds_to_time(obj['avg_time']) } Cumulative recording time:{