Fix TypeError in handle_stats_steps

Fix TypeError in handle_stats_steps for NoneType comparison in node stats command
This commit is contained in:
Jeff Bollinger 2024-11-22 15:02:47 -05:00 committed by GitHub
parent 141eb05156
commit 03d8aebbe1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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') is not None and node['lastHeard'] >= time_limit)
total_nodes_summary.append(f"- {period}: {total_nodes}")
response = "Total nodes seen:\n" + "\n".join(total_nodes_summary)