-
Notifications
You must be signed in to change notification settings - Fork 26
/
teststats.py
executable file
·32 lines (31 loc) · 1 KB
/
teststats.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python3
import json
import os
import os.path
import collections
path = "json"
comments = collections.Counter()
ready = collections.Counter()
for filename in os.listdir(path):
r = None
mapname = os.path.splitext(filename)[0]
with open(os.path.join(path, filename), 'r') as json_file:
j = json.load(json_file)
for message in j["messages"]:
#if "Tester" not in message["author"]["roles"]:
# continue
testername = message["author"]["name"]
if testername == "DDNet":
continue
comments[testername] += 1
for x in message["content"]:
for y in x.get("text", []):
for z in y:
if type(y[z]) == str and y[z].startswith("$ready"):
r = testername
if type(y[z]) == dict and y[z].get("text", "").startswith("$ready"):
r = testername
if r:
ready[r] += 1
print(comments.most_common(20))
print(ready.most_common(20))