Fix result annotation for when certain fields do not exist

This commit is contained in:
Mark Veidemanis 2022-07-29 22:22:22 +01:00
parent eb903fe50b
commit 159a0bd0a1
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 9 additions and 6 deletions

View File

@ -56,10 +56,13 @@ def annotate_results(results_parsed):
net, [x["nick"] for x in results_parsed if x["src"] == "irc"] net, [x["nick"] for x in results_parsed if x["src"] == "irc"]
) )
for item in results_parsed: for item in results_parsed:
if "nick" in item:
if item["nick"] in online_info: if item["nick"] in online_info:
item["online"] = online_info[item["nick"]] item["online"] = online_info[item["nick"]]
if "channel" in item:
if item["channel"] in num_users: if item["channel"] in num_users:
item["num_users"] = num_users[item["channel"]] item["num_users"] = num_users[item["channel"]]
if "nick" in item:
if item["nick"] in num_chans: if item["nick"] in num_chans:
item["num_chans"] = num_chans[item["nick"]] item["num_chans"] = num_chans[item["nick"]]