Fix annotating results and remove debugging code

This commit is contained in:
2022-11-23 18:39:36 +00:00
parent c49c8898eb
commit 1bdd332e6e
4 changed files with 10 additions and 17 deletions

View File

@@ -3,7 +3,7 @@ from datetime import datetime
from core.lib.threshold import annotate_num_chans, annotate_num_users, annotate_online
def annotate_results(results_parsed):
def annotate_results(results):
"""
Accept a list of dict objects, search for the number of channels and users.
Add them to the object.
@@ -11,7 +11,7 @@ def annotate_results(results_parsed):
"""
# Figure out items with net (not discord)
nets = set()
for x in results_parsed["object_list"]:
for x in results:
if "net" in x:
nets.add(x["net"])
@@ -21,7 +21,7 @@ def annotate_results(results_parsed):
set(
[
x["nick"]
for x in results_parsed["object_list"]
for x in results
if {"nick", "src", "net"}.issubset(x)
and x["src"] == "irc"
and x["net"] == net
@@ -32,7 +32,7 @@ def annotate_results(results_parsed):
set(
[
x["channel"]
for x in results_parsed["object_list"]
for x in results
if {"channel", "src", "net"}.issubset(x)
and x["src"] == "irc"
and x["net"] == net
@@ -44,7 +44,7 @@ def annotate_results(results_parsed):
num_users = annotate_num_users(net, channels)
# Annotate the number channels the user is on
num_chans = annotate_num_chans(net, nicks)
for item in results_parsed["object_list"]:
for item in results:
if "net" in item:
if item["net"] == net:
if "nick" in item: