Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
275 changes: 116 additions & 159 deletions API/GeneticPolar.py

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions API/RemoveBadData.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,16 @@ def getError(combination: dict[str, MatchScouting2026], TBAMatch: pd.Series) ->
for i in range(3):
# print("auto_fuel_cycles", data[i]['auto_fuel_cycles'])
# print("teleop_fuel_cycles", data[i]['teleop_fuel_cycles'])
fuel_cycles += data[i]['auto_fuel_cycles']
fuel_cycles += data[i]['teleop_fuel_cycles']
fuel_cycles += data[i].get('auto_fuel_scored', 0)
fuel_cycles += data[i].get('teleop_fuel_scored', 0)
# print("First += in getError")
error += abs((TBAMatch['autoCount'] + (TBAMatch['teleopCount'] + TBAMatch['endGameCount']))-fuel_cycles)
total += abs(TBAMatch['autoCount'] + (TBAMatch['teleopCount'] + TBAMatch['endGameCount']))
# print(type(TBAMatch['autoCount']), TBAMatch['autoCount'])
# print(type(TBAMatch['teleopCount']), TBAMatch['teleopCount'])
# print(type(TBAMatch['endGameCount']), TBAMatch['endGameCount'])
for field in addedData:
if not field == "auto_fuel_cycles" and not field == "teleop_fuel_cycles":
if field not in ["auto_fuel_scored", "teleop_fuel_scored"]:
addedData[field] = data[0][field] + \
data[1][field] + data[2][field]
total += abs(TBAMatch[field])
Expand Down
25 changes: 15 additions & 10 deletions API/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2868,7 +2868,7 @@ def updatePredictions(TBAData: list[TBAMatch2026], calculatedData, eventType: in
"blue_auto_passing_cycles": 0,
"blue_teleop_passing_cycles": 0,

"blue_actual_score": match.score_breakdown["blue"].totalPoints,
"blue_actual_score": None,

"red_teams": match.alliances['red'].team_keys,
"red_dq_team_keys": match.alliances['red'].dq_team_keys,
Expand All @@ -2884,9 +2884,9 @@ def updatePredictions(TBAData: list[TBAMatch2026], calculatedData, eventType: in
"red_auto_passing_cycles": 0,
"red_teleop_passing_cycles": 0,

"red_actual_score": match.score_breakdown["red"].totalPoints,
"red_actual_score": None,

"predicted": False,
"predicted": True,
}
for alliance in match.alliances:
for team in match.alliances[alliance].team_keys:
Expand All @@ -2900,8 +2900,8 @@ def updatePredictions(TBAData: list[TBAMatch2026], calculatedData, eventType: in
matchPrediction[f"{alliance}_auto_points"] += teamData["auto_points"]
matchPrediction[f"{alliance}_teleop_points"] += teamData["teleop_points"]
matchPrediction[f"{alliance}_endgame_points"] += teamData["endgame_points"]
matchPrediction[f"{alliance}_auto_fuel_cycles"] += teamData["auto_fuel_cycles"]
matchPrediction[f"{alliance}_teleop_fuel_cycles"] += teamData["teleop_fuel_cycles"]
matchPrediction[f"{alliance}_auto_fuel_cycles"] += teamData["auto_fuel_scored"]
matchPrediction[f"{alliance}_teleop_fuel_cycles"] += teamData["teleop_fuel_scored"]
for alliance in match.alliances:
if alliance == "red":
opponent = "blue"
Expand Down Expand Up @@ -3113,12 +3113,17 @@ def update_database():
# print("977")
if r.status_code == 200 or not event["up_to_date"]:
try:
headers.pop("If-None-Match")
rankings = json.loads(requests.get(
TBA_API_URL+"event/" + event["key"] + "/rankings", headers=headers).text)["rankings"]
event["rankings"] = rankings
headers.pop("If-None-Match", None) # use None default to avoid KeyError if already missing
response = requests.get(
TBA_API_URL + "event/" + event["key"] + "/rankings", headers=headers)
data = json.loads(response.text)
if data and "rankings" in data and data["rankings"] is not None:
rankings = data["rankings"]
event["rankings"] = rankings
else:
event["rankings"] = []
except Exception as e:
logging.error(str(e)+" "+event["key"])
logging.error(str(e) + " " + event["key"])
event["rankings"] = []
ETagCollection.find_one_and_replace(
{"key": event["key"]}, event)
Expand Down
6 changes: 3 additions & 3 deletions APP/lib/models/team_stats_2026.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class TeamStats2026 with _$TeamStats2026 {
@Default(0.0) double climbing_points,
@Default(0.0) double death_rate,
@Default(0.0) double defense_rate,
@Default(0.0) double auto_fuel_cycles,
@Default(0.0) double teleop_fuel_cycles,
@Default(0.0) double total_fuel_cycles,
@Default(0.0) double auto_fuel_scored,
@Default(0.0) double teleop_fuel_scored,
@Default(0.0) double total_fuel_scored,
@Default(0.0) double foul_points,
@Default(0) int simulated_rp,
@Default(0) int simulated_rank,
Expand Down
110 changes: 55 additions & 55 deletions APP/lib/models/team_stats_2026.freezed.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions APP/lib/models/team_stats_2026.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading