diff options
| author | user <user@node5.net> | 2024-03-23 22:58:48 +0100 |
|---|---|---|
| committer | user <user@node5.net> | 2024-03-23 22:58:48 +0100 |
| commit | 0a3b0a01f704b519bc44e6ca33ba5b833ff93244 (patch) | |
| tree | 6916f729da9bd20e969a9fa694ac7cccd0b2efaf /src/ssh_node5_net.py | |
| parent | a16451a7a1a168d1362004ff951f73bb57c64e29 (diff) | |
fix chart
Diffstat (limited to 'src/ssh_node5_net.py')
| -rw-r--r-- | src/ssh_node5_net.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/ssh_node5_net.py b/src/ssh_node5_net.py index d2c38c9..57754e4 100644 --- a/src/ssh_node5_net.py +++ b/src/ssh_node5_net.py @@ -66,11 +66,10 @@ def index(): histogram = db_handler.get_histogram_detailed() all_dates = sorted(list({d['date'] for d in histogram})) by_ip = {} - for d in histogram: - if d['ip'] not in by_ip: - by_ip[d['ip']] = list(range(len(all_dates))) - for date in all_dates: - by_ip[d['ip']][all_dates.index(d['date'])] = (d['total_count'] if date == d['date'] else 0) + for data in histogram: + if data['ip'] not in by_ip: + by_ip[data['ip']] = [0] * len(all_dates) + by_ip[data['ip']][all_dates.index(data['date'])] = data['total_count'] histogram_chartjs = json.dumps([{ 'label': str(ip), |
