diff --git a/src/countdata.py b/src/countdata.py index d7e6b43..d48bfed 100644 --- a/src/countdata.py +++ b/src/countdata.py @@ -10,9 +10,20 @@ disconnectedcount = 0 def getapcategories(r2): - c = Counter(player['deviceStatus'] for player in r2) - c = dict(c) - return(c) + #c = Counter(player['deviceStatus'] for player in r2) + #c = dict(c) + dev_status_list = [] + for x in range(0, len(r2)): + if "deviceStatus" in r2[x]: + #print("Exists") + dev_status_list.append(r2[x]['deviceStatus']) + else: + #print("Does not exist") + dev_status_list.append("Unknown") + print(dev_status_list) + count_dev = dict(Counter(dev_status_list)) + print(count_dev) + return(count_dev) def getcustomers(r2): c = Counter(player['customerName'] for player in r2) @@ -27,4 +38,4 @@ def getmodels(r2): def getvenues(r2): c = Counter(player['venueName'] for player in r2) c = dict(c) - return(c) \ No newline at end of file + return(c)