mirror of
https://github.com/titanscouting/tra-superscript.git
synced 2024-11-10 06:54:45 +00:00
fixed metrics processing ordering,
added metrics logging
This commit is contained in:
parent
b4766d1b3e
commit
ddf6faeecf
@ -18,10 +18,12 @@ class Client:
|
|||||||
competition = self.competition
|
competition = self.competition
|
||||||
api_key= self.tbakey
|
api_key= self.tbakey
|
||||||
x=requests.get("https://www.thebluealliance.com/api/v3/event/"+competition+"/matches/simple", headers={"X-TBA-Auth-Key":api_key})
|
x=requests.get("https://www.thebluealliance.com/api/v3/event/"+competition+"/matches/simple", headers={"X-TBA-Auth-Key":api_key})
|
||||||
|
json = x.json()
|
||||||
out = []
|
out = []
|
||||||
for i in x.json():
|
for i in json:
|
||||||
if i["actual_time"] != None and i["actual_time"]-cutoff >= 0 and i["comp_level"] == "qm":
|
if i["actual_time"] != None and i["comp_level"] == "qm":
|
||||||
out.append({"match" : i['match_number'], "blue" : list(map(lambda x: int(x[3:]), i['alliances']['blue']['team_keys'])), "red" : list(map(lambda x: int(x[3:]), i['alliances']['red']['team_keys'])), "winner": i["winning_alliance"]})
|
out.append({"match" : i['match_number'], "blue" : list(map(lambda x: int(x[3:]), i['alliances']['blue']['team_keys'])), "red" : list(map(lambda x: int(x[3:]), i['alliances']['red']['team_keys'])), "winner": i["winning_alliance"]})
|
||||||
|
out.sort(key=lambda x: x['match'])
|
||||||
return out
|
return out
|
||||||
|
|
||||||
def get_team_match_data(self, team_num):
|
def get_team_match_data(self, team_num):
|
||||||
|
@ -164,6 +164,8 @@ class Metric (Module):
|
|||||||
|
|
||||||
def _process_data(self):
|
def _process_data(self):
|
||||||
|
|
||||||
|
self.results = {}
|
||||||
|
|
||||||
elo_N = self.config["tests"]["elo"]["N"]
|
elo_N = self.config["tests"]["elo"]["N"]
|
||||||
elo_K = self.config["tests"]["elo"]["K"]
|
elo_K = self.config["tests"]["elo"]["K"]
|
||||||
|
|
||||||
@ -253,6 +255,10 @@ class Metric (Module):
|
|||||||
temp_vector.update(red)
|
temp_vector.update(red)
|
||||||
temp_vector.update(blu)
|
temp_vector.update(blu)
|
||||||
|
|
||||||
|
print(match)
|
||||||
|
|
||||||
|
self.results[match['match']] = temp_vector
|
||||||
|
|
||||||
self.client.push_metric(temp_vector)
|
self.client.push_metric(temp_vector)
|
||||||
|
|
||||||
def _push_results(self):
|
def _push_results(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user