From eebe41c1c3ba64a198337a8e8f5cd06fc255c0da Mon Sep 17 00:00:00 2001 From: Andreas Date: Thu, 10 Oct 2024 17:11:51 +0200 Subject: [PATCH] Added check to skip nodes with a none type last heard status when gathering statistics --- command_handlers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/command_handlers.py b/command_handlers.py index 16157db..3dc2106 100644 --- a/command_handlers.py +++ b/command_handlers.py @@ -135,7 +135,7 @@ def handle_stats_steps(sender_id, message, step, interface): total_nodes = len(interface.nodes) else: time_limit = current_time - seconds - total_nodes = sum(1 for node in interface.nodes.values() if node.get('lastHeard', 0) >= time_limit) + total_nodes = sum(1 for node in interface.nodes.values() if node.get('lastHeard', 0) is not None and node.get('lastHeard', 0) >= time_limit) total_nodes_summary.append(f"- {period}: {total_nodes}") response = "Total nodes seen:\n" + "\n".join(total_nodes_summary)