From db483736f70f0999bb8ab835d612334d44ff73ba Mon Sep 17 00:00:00 2001 From: Thebest-Fish-Programmer Date: Sat, 21 Mar 2026 10:52:45 -0500 Subject: [PATCH 1/2] Fixed Predictions --- API/GeneticPolar.py | 277 ++++++++++++++++++------------------------- API/RemoveBadData.py | 6 +- API/api.py | 25 ++-- 3 files changed, 135 insertions(+), 173 deletions(-) diff --git a/API/GeneticPolar.py b/API/GeneticPolar.py index 5246db6..2c09836 100644 --- a/API/GeneticPolar.py +++ b/API/GeneticPolar.py @@ -13,7 +13,7 @@ ) warnings.filterwarnings("ignore") -NET_ALGAE_COMPLETION_RATE = 0.9 + def flatten_dict(dd, separator="_", prefix=""): @@ -38,22 +38,32 @@ def unpack_nested_list(nested_list): return flat_list +def getPieceScored( + match: dict, + communityStr: str, + allianceStr: str, + row: str, + piece: str, +) -> int: + retval = 0 + for spot in match["score_breakdown"][allianceStr][communityStr][row]: + if spot[:4] == piece: + retval += 1 + return retval + + + def analyzeData(TBAdata: list[TBAMatch2026], scoutingData: list[MatchScouting2026]): data = copy.deepcopy(TBAdata) - # print(data) scoutingBaseData = scoutingData oprMatchList = [] + # Isolating Data Related to OPR blankOprEntry = { - "endgame_scoring": 0, - "total_points": 0, - "total_tower_points": 0, - - # "auto_fuel_cycles": 0, - # "teleop_fuel_cycles": 0, - # "total_fuel_cycles": 0, - + "auto_fuel_scored": 0, + "teleop_fuel_scored": 0, + "total_fuel_scored": 0, "foul_points": 0, "station1": 0, @@ -70,78 +80,66 @@ def analyzeData(TBAdata: list[TBAMatch2026], scoutingData: list[MatchScouting202 "match_number": 0, "allianceStr": "", - } - for row in data: - if row.score_breakdown is None: - continue - - for allianceStr in row.alliances: - breakdown = row.score_breakdown[allianceStr] - - oprMatchEntry = copy.deepcopy(blankOprEntry) - - - oprMatchEntry["allianceStr"] = allianceStr - oprMatchEntry["match_number"] = row.match_number - - for k in range(3): - oprMatchEntry[f"station{k+1}"] = row.alliances[allianceStr].team_keys[k][3:] - - - oprMatchEntry["station1_auto_tower"] = breakdown.autoTowerRobot1 - oprMatchEntry["station2_auto_tower"] = breakdown.autoTowerRobot2 - oprMatchEntry["station3_auto_tower"] = breakdown.autoTowerRobot3 - - - oprMatchEntry["station1_endgame_tower"] = breakdown.endGameTowerRobot1 - oprMatchEntry["station2_endgame_tower"] = breakdown.endGameTowerRobot2 - oprMatchEntry["station3_endgame_tower"] = breakdown.endGameTowerRobot3 - - - oprMatchEntry["endgame_scoring"] = breakdown.endGameTowerPoints - oprMatchEntry["total_tower_points"] = breakdown.totalTowerPoints - oprMatchEntry["total_points"] = breakdown.totalPoints - oprMatchEntry["auto_fuel_cycles"] = breakdown.hubScore.autoCount - oprMatchEntry["teleop_fuel_cycles"] = breakdown.hubScore.teleopCount - oprMatchEntry["total_fuel_cycles"] = breakdown.hubScore.autoCount + breakdown.hubScore.teleopCount - - oprMatchEntry["foul_points"] = breakdown.foulPoints - # print(oprMatchEntry) - - + if not row.score_breakdown == None: + for allianceStr in row.alliances: + if allianceStr == 'red': + opponentStr = 'blue' + else: + opponentStr = 'red' + oprMatchEntry = copy.deepcopy(blankOprEntry) + oprMatchEntry["allianceStr"] = allianceStr + oprMatchEntry["match_number"] = row.match_number + for k in range(3): + oprMatchEntry["station" + + str(k + 1)] = row.alliances[allianceStr].team_keys[k][3:] + + oprMatchEntry["auto_fuel_scored"] = row.score_breakdown[allianceStr].hubScore.autoCount + oprMatchEntry["teleop_fuel_scored"] = row.score_breakdown[allianceStr].hubScore.teleopCount + oprMatchEntry["total_fuel_scored"] = row.score_breakdown[allianceStr].hubScore.teleopCount + row.score_breakdown[allianceStr].hubScore.autoCount + + oprMatchEntry["foul_points"] = row.score_breakdown[allianceStr].foulPoints + + oprMatchEntry["station1_auto_tower"] = row.score_breakdown[allianceStr].autoTowerRobot1 + oprMatchEntry["station2_auto_tower"] = row.score_breakdown[allianceStr].autoTowerRobot2 + oprMatchEntry["station3_auto_tower"] = row.score_breakdown[allianceStr].autoTowerRobot3 + + oprMatchEntry["station1_endgame_tower"] = row.score_breakdown[allianceStr].endGameTowerRobot1 + oprMatchEntry["station2_endgame_tower"] = row.score_breakdown[allianceStr].endGameTowerRobot2 + oprMatchEntry["station3_endgame_tower"] = row.score_breakdown[allianceStr].endGameTowerRobot3 + + oprMatchEntry["endgame_scoring"] = row.score_breakdown[allianceStr].endGameTowerPoints + oprMatchEntry["total_points"] = row.score_breakdown[allianceStr].totalPoints + oprMatchEntry["total_tower_points"] = row.score_breakdown[allianceStr].totalTowerPoints - - oprMatchList.append(copy.deepcopy(oprMatchEntry)) + oprMatchList.append(copy.deepcopy(oprMatchEntry)) oprMatchDataFrame = pd.DataFrame(oprMatchList) # print(oprMatchDataFrame) - teams = [] - for k in range(3): - # print(k) - for matchTeam in oprMatchDataFrame["station" + str(k + 1)]: - exists = False - exists = teams.__contains__(matchTeam) - # print(exists) - if not exists: + teams = [] + for k in range(3): + for matchTeam in oprMatchDataFrame["station" + str(k + 1)]: + exists = False + exists = teams.__contains__(matchTeam) + if not exists: teams.append(matchTeam) teams.sort() - # print("made list of team") + # print("made list of teams") # Initializing sets of Data teamMatchCount = np.zeros(len(teams)) - autoClimb = np.zeros(len(teams)) - endgameClimbL1 = np.zeros(len(teams)) - endgameClimbL2 = np.zeros(len(teams)) - endgameClimbL3 = np.zeros(len(teams)) autoPoints = np.zeros(len(teams)) teleopPoints = np.zeros(len(teams)) teamDeaths = np.zeros(len(teams)) teamDefenses = np.zeros(len(teams)) matchScoutingCount = np.zeros(len(teams)) - autoPass = np.zeros(len(teams)) - telePass = np.zeros(len(teams)) - + + autoClimb = np.zeros(len(teams)) + endgameClimbL1 = np.zeros(len(teams)) + endgameClimbL2 = np.zeros(len(teams)) + endgameClimbL3 = np.zeros(len(teams)) + autoPassing = np.zeros(len(teams)) + teleopPassing = np.zeros(len(teams)) # Counting the number of matches that each team has stations = ['station1', 'station2', 'station3'] @@ -176,91 +174,55 @@ def analyzeData(TBAdata: list[TBAMatch2026], scoutingData: list[MatchScouting202 if row["station" + str(k + 1) + "_auto_tower"] == "Level1" or row["station" + str(k + 1) + "_auto_tower"] == "Level2" or row["station" + str(k + 1) + "_auto_tower"] == "Level3": autoClimb[idx] += 1 - # print("found TBA only stats") # Analyzing data coming directly from scouting data - # print("Scouting data length:", len(scoutingBaseData)) - # print("First few entries:", scoutingBaseData[:3]) - - team_idx_map = {team: i for i, team in enumerate(teams)} - # print("Team index map:", team_idx_map) - for entry in scoutingBaseData: - # print("Processing entry:", entry) - # print(type(entry)) - team_str = str(entry.team_number) - - idx = team_idx_map.get(team_str) - - # print("Starting idx potential error") - if idx is not None: - # print("started match") - matchScoutingCount[idx] += 1 - # print("started died") - teamDeaths[idx] += 1 if entry.data.miscellaneous.died else 0 - # print("started defense") - teamDefenses[idx] += entry.data.miscellaneous.defense or 0 - # print("started autoPass") - autoPass[idx] += entry.data.auto_scoring.passing_cycles or 0 - # print("started teleopPass") - telePass[idx] += entry.data.teleop_scoring.passing_cycles or 0 - else: - print(f"Skipping scouting entry for team {team_str} (not in TBA matches)") - # print("Finished the idx") - - # print("Match scouting counts:", matchScoutingCount) - # print("Team deaths:", teamDeaths) - # print("Auto passing cycles:", autoPass) - # print("Teleop passing cycles:", telePass) - + matchScoutingCount[teams.index(str(entry.team_number))] += 1 + teamDefenses[teams.index(str(entry.team_number))] += 1 + autoPassing[teams.index(str(entry.team_number))] += 1 + teleopPassing[teams.index(str(entry.team_number))] += 1 + teamDeaths[teams.index(str(entry.team_number)) + ] += 1 if entry.data.miscellaneous.died else 0 # All of the keys, maxs, and mins - # ScoutingDataKeys = [ - # "auto_fuel_cycles", - # "teleop_fuel_cycles", + # ] # ScoutingDataMins = [ - # 0, - # 0, + # ] # ScoutingDataMaxs = [ - # 10000, - # 10000, + # ] - TBAOnlyKeys = [ - "auto_fuel_cycles", - "teleop_fuel_cycles", - "foul_points", + "auto_fuel_scored", + "teleop_fuel_scored", + "foul_points", ] - TBAOnlyMins = [ 0, 0, 0, ] TBAOnlyMaxs = [ - 10000, - 10000, - 10000, + 1000000, + 1000000, + 1000000, ] OPRWeights = [ - 1, - 1, - -1, + 1, + 1, + -1, ] numEntries = len(scoutingBaseData) - j = numEntries # set j to the max number of scouting entries to analyze + j = numEntries # set j to the max number of scout entries to analyze # print("setup hardcoded stuff") # TBA Data # YMatrix = pd.DataFrame(None, columns=unpack_nested_list(ScoutingDataKeys)) TBAOnlyYMatrix = pd.DataFrame(None, columns=TBAOnlyKeys) - # print(ScoutingDataKeys) # YMatrix = oprMatchDataFrame[unpack_nested_list(ScoutingDataKeys)] # print("ymatrix set up") - # print(YMatrix) TBAOnlyYMatrix = pd.DataFrame(oprMatchDataFrame[TBAOnlyKeys]) # print("tba only ymatrix set up") matchTeamMatrix = oprMatchDataFrame[["station1", "station2", "station3"]] @@ -306,11 +268,9 @@ def analyzeData(TBAdata: list[TBAMatch2026], scoutingData: list[MatchScouting202 Alist = [] teamIdx = -1 for team in teams: - teamIdx += 1 - # teamYEntry = np.zeros(len(unpack_nested_list(ScoutingDataKeys))) - teamYEntry = np.zeros(len(unpack_nested_list(TBAOnlyKeys))) + teamYEntry = np.zeros(len(TBAOnlyKeys)) for teamMatch in teamMatchesList[team]: numEntries = 0 for entry in scoutingData: @@ -318,9 +278,7 @@ def analyzeData(TBAdata: list[TBAMatch2026], scoutingData: list[MatchScouting202 str(entry.team_number) == team and entry.match_number == teamMatch ): - # print("numentries") numEntries += 1 - # print("finished numentires") for entry in scoutingData: if ( str(entry.team_number) == team @@ -348,6 +306,7 @@ def analyzeData(TBAdata: list[TBAMatch2026], scoutingData: list[MatchScouting202 # print("ready for regression") # Multivariate Regression XMatrix = pd.DataFrame() + TBAOnlyXMatrix = pd.DataFrame(TBAOnlyAPseudoInverse @ TBAOnlyYMatrix) # Run Genetic Algorithm @@ -365,6 +324,7 @@ def func(solution, functionInputs): exceeding_min = solutionMatrix < min exceeding_max = solutionMatrix > max error += 1000 * (np.sum(exceeding_min) + np.sum(exceeding_max)) + return error return func @@ -391,8 +351,9 @@ def func(solution, functionInputs): # for key in result[0].columns: # if type(result[0][key].tolist()) is not None: # results.append(result[0][key].tolist()) + # Number of processes to run simultaneously - # num_processes = 10 # Adjust this value based on your system's capabilities + num_processes = 10 # Adjust this value based on your system's capabilities # for i in range(len(ScoutingDataKeys)): # perform_genetic_algorithm(i) # results = joblib.Parallel(num_processes)(joblib.delayed(perform_genetic_algorithm)(i) for i in range(10)) @@ -414,9 +375,10 @@ def func(solution, functionInputs): for key in result[0].columns: if result[0][key] is not None: results.append(result[0][key].tolist()) - # # results.append((result[0], len(ScoutingDataKeys)+i)) + # results.append((result[0], len(ScoutingDataKeys)+i)) # dataKeys = copy.deepcopy(unpack_nested_list(ScoutingDataKeys)) dataKeys = copy.deepcopy(unpack_nested_list(TBAOnlyKeys)) + dataKeys.extend(unpack_nested_list(TBAOnlyKeys)) # print("compiling data to json") # print(results) for i, result in enumerate(results): @@ -424,16 +386,11 @@ def func(solution, functionInputs): # print(dataKeys[i], i) # print(result) array = np.array(result).ravel() - XMatrix[dataKeys[i]] = result - + TBAOnlyXMatrix[dataKeys[i]] = result if i < 1: - # print("auto points") autoPoints += array*OPRWeights[i] - # print("finished auto points") elif i < 2: - # print("teleop points") teleopPoints += array*OPRWeights[i] - # print("finished teleop points") # except Exception as e: # print(i, e) # print("looped through results") @@ -441,31 +398,34 @@ def func(solution, functionInputs): endgameClimbL1 = endgameClimbL1 / teamMatchCount endgameClimbL2 = endgameClimbL2 / teamMatchCount endgameClimbL3 = endgameClimbL3 / teamMatchCount - autoPass = autoPass / matchScoutingCount - telePass = telePass / matchScoutingCount + autoPassing = autoPassing / matchScoutingCount + teleopPassing = teleopPassing / matchScoutingCount - for i in range(len(telePass)): - if math.isnan(telePass[i]): - telePass[i] = 0 - for i in range(len(autoPass)): - if math.isnan(autoPass[i]): - autoPass[i] = 0 - teamDeaths /= matchScoutingCount for i in range(len(teamDeaths)): if math.isnan(teamDeaths[i]): teamDeaths[i] = 0 - teamDefenses /= matchScoutingCount for i in range(len(teamDefenses)): if math.isnan(teamDefenses[i]): teamDefenses[i] = 0 - endgamePoints = endgameClimbL1 * 10 + endgameClimbL2 * 20 + endgameClimbL3 * 30 - # print("auto climb += auto points") - autoPoints += autoClimb * 15 - # print("finished auot climb += auto points") - teamClimbingPoints = endgameClimbL1 * 10 + endgameClimbL2 * 20 + endgameClimbL3 * 30 + autoClimb * 15 - # teleopPoints += teamFeeding + for i in range(len(autoPassing)): + if math.isnan(autoPassing[i]): + autoPassing[i] = 0 + for i in range(len(teleopPassing)): + if math.isnan(teleopPassing[i]): + teleopPassing[i] = 0 + L1Points = 10 + L2Points = 20 + L3Points = 30 + autoClimbPoints = 15 + endgameClimbingPoints = endgameClimbL1 * L1Points + endgameClimbL2 * L2Points + endgameClimbL3 * L3Points + autoClimbingPoints = autoClimb * autoClimbPoints + endgamePoints = endgameClimbingPoints + autoPoints = autoClimbingPoints + teamClimbingPoints = autoClimbingPoints + endgameClimbingPoints teamOPR = endgamePoints + autoPoints + teleopPoints - + + XMatrix['auto_fuel_scored'] = autoPoints + XMatrix['teleop_fuel_scored'] = teleopPoints XMatrix.insert(0, 'death_rate', pd.Series(teamDeaths)) XMatrix.insert(0, 'defense_rate', pd.Series(teamDefenses)) XMatrix.insert(0, 'climbing_points', pd.Series(teamClimbingPoints)) @@ -476,19 +436,16 @@ def func(solution, functionInputs): XMatrix.insert(0, 'endgame_climb_L1_rate', pd.Series(endgameClimbL1)) XMatrix.insert(0, 'endgame_climb_L2_rate', pd.Series(endgameClimbL2)) XMatrix.insert(0, 'endgame_climb_L3_rate', pd.Series(endgameClimbL3)) - XMatrix.insert(0, 'teleop_pass', pd.Series(telePass)) - XMatrix.insert(0, 'auto_pass', pd.Series(autoPass)) - XMatrix.insert(0, 'total_pass', pd.Series(telePass + autoPass)) + XMatrix.insert(0, 'teleop_pass', pd.Series(teleopPassing)) + XMatrix.insert(0, 'auto_pass', pd.Series(autoPassing)) + XMatrix.insert(0, 'total_pass', pd.Series(teleopPassing + autoPassing)) XMatrix.insert(0, 'OPR', pd.Series(teamOPR)) XMatrix.insert(0, 'scouting_data_count', pd.Series(matchScoutingCount)) XMatrix.insert(0, 'match_count', pd.Series(teamMatchCount)) XMatrix.insert(0, 'team_number', pd.Series(teams)) XMatrix.insert( 0, - 'total_fuel_cycles', - XMatrix['auto_fuel_cycles'] + XMatrix['teleop_fuel_cycles'] + 'total_fuel_scored', + XMatrix['auto_fuel_scored'] + XMatrix['teleop_fuel_scored'] ) - - - # print(XMatrix) return XMatrix, ratings \ No newline at end of file diff --git a/API/RemoveBadData.py b/API/RemoveBadData.py index 72f4d68..fb5ec17 100644 --- a/API/RemoveBadData.py +++ b/API/RemoveBadData.py @@ -95,8 +95,8 @@ 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'])) @@ -104,7 +104,7 @@ def getError(combination: dict[str, MatchScouting2026], TBAMatch: pd.Series) -> # 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]) diff --git a/API/api.py b/API/api.py index 43710fe..377ba6e 100644 --- a/API/api.py +++ b/API/api.py @@ -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, @@ -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: @@ -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" @@ -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) From 7f170eff83103d4c6dcb9c21d73aba7f8238ba9d Mon Sep 17 00:00:00 2001 From: Thebest-Fish-Programmer Date: Sat, 21 Mar 2026 13:21:01 -0500 Subject: [PATCH 2/2] I fixed the predictions on the frontend so that they would load --- API/GeneticPolar.py | 4 +- APP/lib/models/team_stats_2026.dart | 6 +- APP/lib/models/team_stats_2026.freezed.dart | 110 ++++++++++---------- APP/lib/models/team_stats_2026.g.dart | 14 +-- APP/lib/pages/event_page.dart | 33 +++--- APP/lib/pages/match_page.dart | 20 ++-- APP/lib/pages/pick_list_page.dart | 14 +-- 7 files changed, 99 insertions(+), 102 deletions(-) diff --git a/API/GeneticPolar.py b/API/GeneticPolar.py index 2c09836..96a10d6 100644 --- a/API/GeneticPolar.py +++ b/API/GeneticPolar.py @@ -420,10 +420,10 @@ def func(solution, functionInputs): endgameClimbingPoints = endgameClimbL1 * L1Points + endgameClimbL2 * L2Points + endgameClimbL3 * L3Points autoClimbingPoints = autoClimb * autoClimbPoints endgamePoints = endgameClimbingPoints - autoPoints = autoClimbingPoints + autoPoints += autoClimbingPoints teamClimbingPoints = autoClimbingPoints + endgameClimbingPoints teamOPR = endgamePoints + autoPoints + teleopPoints - + XMatrix['auto_fuel_scored'] = autoPoints XMatrix['teleop_fuel_scored'] = teleopPoints XMatrix.insert(0, 'death_rate', pd.Series(teamDeaths)) diff --git a/APP/lib/models/team_stats_2026.dart b/APP/lib/models/team_stats_2026.dart index 54c45a4..92fecb6 100644 --- a/APP/lib/models/team_stats_2026.dart +++ b/APP/lib/models/team_stats_2026.dart @@ -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, diff --git a/APP/lib/models/team_stats_2026.freezed.dart b/APP/lib/models/team_stats_2026.freezed.dart index 3d46341..1ea62e6 100644 --- a/APP/lib/models/team_stats_2026.freezed.dart +++ b/APP/lib/models/team_stats_2026.freezed.dart @@ -36,9 +36,9 @@ mixin _$TeamStats2026 { double get climbing_points => throw _privateConstructorUsedError; double get death_rate => throw _privateConstructorUsedError; double get defense_rate => throw _privateConstructorUsedError; - double get auto_fuel_cycles => throw _privateConstructorUsedError; - double get teleop_fuel_cycles => throw _privateConstructorUsedError; - double get total_fuel_cycles => throw _privateConstructorUsedError; + double get auto_fuel_scored => throw _privateConstructorUsedError; + double get teleop_fuel_scored => throw _privateConstructorUsedError; + double get total_fuel_scored => throw _privateConstructorUsedError; double get foul_points => throw _privateConstructorUsedError; int get simulated_rp => throw _privateConstructorUsedError; int get simulated_rank => throw _privateConstructorUsedError; @@ -76,9 +76,9 @@ abstract class $TeamStats2026CopyWith<$Res> { double climbing_points, double death_rate, double defense_rate, - double auto_fuel_cycles, - double teleop_fuel_cycles, - double total_fuel_cycles, + double auto_fuel_scored, + double teleop_fuel_scored, + double total_fuel_scored, double foul_points, int simulated_rp, int simulated_rank}); @@ -115,9 +115,9 @@ class _$TeamStats2026CopyWithImpl<$Res, $Val extends TeamStats2026> Object? climbing_points = null, Object? death_rate = null, Object? defense_rate = null, - Object? auto_fuel_cycles = null, - Object? teleop_fuel_cycles = null, - Object? total_fuel_cycles = null, + Object? auto_fuel_scored = null, + Object? teleop_fuel_scored = null, + Object? total_fuel_scored = null, Object? foul_points = null, Object? simulated_rp = null, Object? simulated_rank = null, @@ -187,17 +187,17 @@ class _$TeamStats2026CopyWithImpl<$Res, $Val extends TeamStats2026> ? _value.defense_rate : defense_rate // ignore: cast_nullable_to_non_nullable as double, - auto_fuel_cycles: null == auto_fuel_cycles - ? _value.auto_fuel_cycles - : auto_fuel_cycles // ignore: cast_nullable_to_non_nullable + auto_fuel_scored: null == auto_fuel_scored + ? _value.auto_fuel_scored + : auto_fuel_scored // ignore: cast_nullable_to_non_nullable as double, - teleop_fuel_cycles: null == teleop_fuel_cycles - ? _value.teleop_fuel_cycles - : teleop_fuel_cycles // ignore: cast_nullable_to_non_nullable + teleop_fuel_scored: null == teleop_fuel_scored + ? _value.teleop_fuel_scored + : teleop_fuel_scored // ignore: cast_nullable_to_non_nullable as double, - total_fuel_cycles: null == total_fuel_cycles - ? _value.total_fuel_cycles - : total_fuel_cycles // ignore: cast_nullable_to_non_nullable + total_fuel_scored: null == total_fuel_scored + ? _value.total_fuel_scored + : total_fuel_scored // ignore: cast_nullable_to_non_nullable as double, foul_points: null == foul_points ? _value.foul_points @@ -240,9 +240,9 @@ abstract class _$$TeamStats2026ImplCopyWith<$Res> double climbing_points, double death_rate, double defense_rate, - double auto_fuel_cycles, - double teleop_fuel_cycles, - double total_fuel_cycles, + double auto_fuel_scored, + double teleop_fuel_scored, + double total_fuel_scored, double foul_points, int simulated_rp, int simulated_rank}); @@ -277,9 +277,9 @@ class __$$TeamStats2026ImplCopyWithImpl<$Res> Object? climbing_points = null, Object? death_rate = null, Object? defense_rate = null, - Object? auto_fuel_cycles = null, - Object? teleop_fuel_cycles = null, - Object? total_fuel_cycles = null, + Object? auto_fuel_scored = null, + Object? teleop_fuel_scored = null, + Object? total_fuel_scored = null, Object? foul_points = null, Object? simulated_rp = null, Object? simulated_rank = null, @@ -349,17 +349,17 @@ class __$$TeamStats2026ImplCopyWithImpl<$Res> ? _value.defense_rate : defense_rate // ignore: cast_nullable_to_non_nullable as double, - auto_fuel_cycles: null == auto_fuel_cycles - ? _value.auto_fuel_cycles - : auto_fuel_cycles // ignore: cast_nullable_to_non_nullable + auto_fuel_scored: null == auto_fuel_scored + ? _value.auto_fuel_scored + : auto_fuel_scored // ignore: cast_nullable_to_non_nullable as double, - teleop_fuel_cycles: null == teleop_fuel_cycles - ? _value.teleop_fuel_cycles - : teleop_fuel_cycles // ignore: cast_nullable_to_non_nullable + teleop_fuel_scored: null == teleop_fuel_scored + ? _value.teleop_fuel_scored + : teleop_fuel_scored // ignore: cast_nullable_to_non_nullable as double, - total_fuel_cycles: null == total_fuel_cycles - ? _value.total_fuel_cycles - : total_fuel_cycles // ignore: cast_nullable_to_non_nullable + total_fuel_scored: null == total_fuel_scored + ? _value.total_fuel_scored + : total_fuel_scored // ignore: cast_nullable_to_non_nullable as double, foul_points: null == foul_points ? _value.foul_points @@ -397,9 +397,9 @@ class _$TeamStats2026Impl implements _TeamStats2026 { this.climbing_points = 0.0, this.death_rate = 0.0, this.defense_rate = 0.0, - this.auto_fuel_cycles = 0.0, - this.teleop_fuel_cycles = 0.0, - this.total_fuel_cycles = 0.0, + this.auto_fuel_scored = 0.0, + this.teleop_fuel_scored = 0.0, + this.total_fuel_scored = 0.0, this.foul_points = 0.0, this.simulated_rp = 0, this.simulated_rank = 0}); @@ -452,13 +452,13 @@ class _$TeamStats2026Impl implements _TeamStats2026 { final double defense_rate; @override @JsonKey() - final double auto_fuel_cycles; + final double auto_fuel_scored; @override @JsonKey() - final double teleop_fuel_cycles; + final double teleop_fuel_scored; @override @JsonKey() - final double total_fuel_cycles; + final double total_fuel_scored; @override @JsonKey() final double foul_points; @@ -471,7 +471,7 @@ class _$TeamStats2026Impl implements _TeamStats2026 { @override String toString() { - return 'TeamStats2026(historical: $historical, key: $key, rank: $rank, team_number: $team_number, match_count: $match_count, OPR: $OPR, OPRRank: $OPRRank, total_pass: $total_pass, auto_pass: $auto_pass, teleop_pass: $teleop_pass, endgame_points: $endgame_points, teleop_points: $teleop_points, auto_points: $auto_points, climbing_points: $climbing_points, death_rate: $death_rate, defense_rate: $defense_rate, auto_fuel_cycles: $auto_fuel_cycles, teleop_fuel_cycles: $teleop_fuel_cycles, total_fuel_cycles: $total_fuel_cycles, foul_points: $foul_points, simulated_rp: $simulated_rp, simulated_rank: $simulated_rank)'; + return 'TeamStats2026(historical: $historical, key: $key, rank: $rank, team_number: $team_number, match_count: $match_count, OPR: $OPR, OPRRank: $OPRRank, total_pass: $total_pass, auto_pass: $auto_pass, teleop_pass: $teleop_pass, endgame_points: $endgame_points, teleop_points: $teleop_points, auto_points: $auto_points, climbing_points: $climbing_points, death_rate: $death_rate, defense_rate: $defense_rate, auto_fuel_scored: $auto_fuel_scored, teleop_fuel_scored: $teleop_fuel_scored, total_fuel_scored: $total_fuel_scored, foul_points: $foul_points, simulated_rp: $simulated_rp, simulated_rank: $simulated_rank)'; } @override @@ -507,12 +507,12 @@ class _$TeamStats2026Impl implements _TeamStats2026 { other.death_rate == death_rate) && (identical(other.defense_rate, defense_rate) || other.defense_rate == defense_rate) && - (identical(other.auto_fuel_cycles, auto_fuel_cycles) || - other.auto_fuel_cycles == auto_fuel_cycles) && - (identical(other.teleop_fuel_cycles, teleop_fuel_cycles) || - other.teleop_fuel_cycles == teleop_fuel_cycles) && - (identical(other.total_fuel_cycles, total_fuel_cycles) || - other.total_fuel_cycles == total_fuel_cycles) && + (identical(other.auto_fuel_scored, auto_fuel_scored) || + other.auto_fuel_scored == auto_fuel_scored) && + (identical(other.teleop_fuel_scored, teleop_fuel_scored) || + other.teleop_fuel_scored == teleop_fuel_scored) && + (identical(other.total_fuel_scored, total_fuel_scored) || + other.total_fuel_scored == total_fuel_scored) && (identical(other.foul_points, foul_points) || other.foul_points == foul_points) && (identical(other.simulated_rp, simulated_rp) || @@ -541,9 +541,9 @@ class _$TeamStats2026Impl implements _TeamStats2026 { climbing_points, death_rate, defense_rate, - auto_fuel_cycles, - teleop_fuel_cycles, - total_fuel_cycles, + auto_fuel_scored, + teleop_fuel_scored, + total_fuel_scored, foul_points, simulated_rp, simulated_rank @@ -583,9 +583,9 @@ abstract class _TeamStats2026 implements TeamStats2026 { final double climbing_points, final double death_rate, final double defense_rate, - final double auto_fuel_cycles, - final double teleop_fuel_cycles, - final double total_fuel_cycles, + final double auto_fuel_scored, + final double teleop_fuel_scored, + final double total_fuel_scored, final double foul_points, final int simulated_rp, final int simulated_rank}) = _$TeamStats2026Impl; @@ -626,11 +626,11 @@ abstract class _TeamStats2026 implements TeamStats2026 { @override double get defense_rate; @override - double get auto_fuel_cycles; + double get auto_fuel_scored; @override - double get teleop_fuel_cycles; + double get teleop_fuel_scored; @override - double get total_fuel_cycles; + double get total_fuel_scored; @override double get foul_points; @override diff --git a/APP/lib/models/team_stats_2026.g.dart b/APP/lib/models/team_stats_2026.g.dart index a536bd9..8b112de 100644 --- a/APP/lib/models/team_stats_2026.g.dart +++ b/APP/lib/models/team_stats_2026.g.dart @@ -24,10 +24,10 @@ _$TeamStats2026Impl _$$TeamStats2026ImplFromJson(Map json) => climbing_points: (json['climbing_points'] as num?)?.toDouble() ?? 0.0, death_rate: (json['death_rate'] as num?)?.toDouble() ?? 0.0, defense_rate: (json['defense_rate'] as num?)?.toDouble() ?? 0.0, - auto_fuel_cycles: (json['auto_fuel_cycles'] as num?)?.toDouble() ?? 0.0, - teleop_fuel_cycles: - (json['teleop_fuel_cycles'] as num?)?.toDouble() ?? 0.0, - total_fuel_cycles: (json['total_fuel_cycles'] as num?)?.toDouble() ?? 0.0, + auto_fuel_scored: (json['auto_fuel_scored'] as num?)?.toDouble() ?? 0.0, + teleop_fuel_scored: + (json['teleop_fuel_scored'] as num?)?.toDouble() ?? 0.0, + total_fuel_scored: (json['total_fuel_scored'] as num?)?.toDouble() ?? 0.0, foul_points: (json['foul_points'] as num?)?.toDouble() ?? 0.0, simulated_rp: (json['simulated_rp'] as num?)?.toInt() ?? 0, simulated_rank: (json['simulated_rank'] as num?)?.toInt() ?? 0, @@ -51,9 +51,9 @@ Map _$$TeamStats2026ImplToJson(_$TeamStats2026Impl instance) => 'climbing_points': instance.climbing_points, 'death_rate': instance.death_rate, 'defense_rate': instance.defense_rate, - 'auto_fuel_cycles': instance.auto_fuel_cycles, - 'teleop_fuel_cycles': instance.teleop_fuel_cycles, - 'total_fuel_cycles': instance.total_fuel_cycles, + 'auto_fuel_scored': instance.auto_fuel_scored, + 'teleop_fuel_scored': instance.teleop_fuel_scored, + 'total_fuel_scored': instance.total_fuel_scored, 'foul_points': instance.foul_points, 'simulated_rp': instance.simulated_rp, 'simulated_rank': instance.simulated_rank, diff --git a/APP/lib/pages/event_page.dart b/APP/lib/pages/event_page.dart index 7e880ca..9f9e216 100644 --- a/APP/lib/pages/event_page.dart +++ b/APP/lib/pages/event_page.dart @@ -186,13 +186,13 @@ class _RankingsTabState extends State<_RankingsTab> { GridColumn( allowSorting: true, label: Text('Auto Fuel Points', style: TextStyle(fontFamily: 'Font')), - columnName: 'auto_fuel_cycles', + columnName: 'auto_fuel_scored', allowFiltering: false, ), GridColumn( allowSorting: true, label: Text('Teleop Fuel Points', style: TextStyle(fontFamily: 'Font')), - columnName: 'teleop_fuel_cycles', + columnName: 'teleop_fuel_scored', allowFiltering: false, ), GridColumn( @@ -224,8 +224,8 @@ class _RankingsTabState extends State<_RankingsTab> { 'OPR': true, 'rank': true, 'simulated_rp': true, - 'auto_fuel_cycles': true, - 'teleop_fuel_cycles': true, + 'auto_fuel_scored': true, + 'teleop_fuel_scored': true, 'climbing_points': true, 'defense_rate': true, 'death_rate': true, @@ -675,14 +675,10 @@ class _OvertimeChartOnClick extends StatelessWidget { 'entries': [], }; List seriesLabels = [ - 'auto_scoring_fuel_cycles', + 'auto_scoring_fuel_scored', 'auto_scoring_passing_cycles', - 'auto_scoring_scoring_cycles', - 'auto_scoring_cycles_completed', - 'teleop_scoring_fuel_cycles', + 'teleop_scoring_fuel_scored', 'teleop_scoring_passing_cycles', - 'teleop_scoring_scoring_cycles', - 'teleop_scoring_cycles_completed', ]; for (var series in seriesLabels) { seriesData[series] = []; @@ -1067,9 +1063,9 @@ class _ChartsTabState extends State<_ChartsTab> { 'entries': [], }; List seriesLabels = [ - 'auto_scoring_fuel_cycles', + 'auto_scoring_fuel_scored', 'auto_scoring_passing_cycles', - 'teleop_scoring_fuel_cycles', + 'teleop_scoring_fuel_scored', 'teleop_scoring_passing_cycles', ]; for (var series in seriesLabels) { @@ -1457,12 +1453,12 @@ class _ChartsTabState extends State<_ChartsTab> { startingFields: [ Field( name: 'Teleop Fuel', - key: 'teleop_fuel_cycles', + key: 'teleop_fuel_scored', enabled: true, weight: 1), Field( name: 'Auto Fuel', - key: 'auto_fuel_cycles', + key: 'auto_fuel_scored', enabled: true, weight: 1), ])), @@ -1476,12 +1472,12 @@ class _ChartsTabState extends State<_ChartsTab> { startingFields: [ Field( name: 'Teleop Fuel', - key: 'teleop_fuel_cycles', + key: 'teleop_fuel_scored', enabled: true, weight: 1), Field( name: 'Auto Fuel', - key: 'auto_fuel_cycles', + key: 'auto_fuel_scored', enabled: true, weight: 1), Field( @@ -1980,8 +1976,9 @@ class _MatchScoutingTabState extends State<_MatchScoutingTab> { // teleop_scoring: data.data.teleop_scoring // .copyWith(fuel_cycles: val)))); // }), - _buildCounterRow('Passed Balls', - data.data.teleop_scoring.passing_cycles, (val) { + _buildCounterRow( + 'Passed Balls', data.data.teleop_scoring.passing_cycles, + (val) { setState(() => data = data.copyWith( data: data.data.copyWith( teleop_scoring: data.data.teleop_scoring diff --git a/APP/lib/pages/match_page.dart b/APP/lib/pages/match_page.dart index bfe1786..f2c54e2 100644 --- a/APP/lib/pages/match_page.dart +++ b/APP/lib/pages/match_page.dart @@ -324,7 +324,7 @@ class _StatsTabState extends State<_StatsTab> { ), ), GridColumn( - columnName: 'tele_pass', + columnName: 'teleop_pass', label: Text( 'Teleop Passing', style: TextStyle(fontFamily: 'Font'), @@ -364,8 +364,8 @@ class _StatsTabState extends State<_StatsTab> { double blueTelePass = 0; for (var blueTeam in stats?.blue_teams ?? []) { blueOPR += blueTeam.OPR; - blueAutoFuel += blueTeam.auto_fuel_cycles; - blueTeleFuel += blueTeam.teleop_fuel_cycles; + blueAutoFuel += blueTeam.auto_fuel_scored; + blueTeleFuel += blueTeam.teleop_fuel_scored; blueAutoPass += blueTeam.auto_pass; blueTelePass += blueTeam.teleop_pass; blueRows.add(DataGridRow(cells: [ @@ -373,9 +373,9 @@ class _StatsTabState extends State<_StatsTab> { columnName: 'team_number', value: blueTeam.key.substring(3)), DataGridCell(columnName: 'opr', value: blueTeam.OPR), DataGridCell( - columnName: 'auto_fuel', value: blueTeam.auto_fuel_cycles), + columnName: 'auto_fuel', value: blueTeam.auto_fuel_scored), DataGridCell( - columnName: 'tele_fuel', value: blueTeam.teleop_fuel_cycles), + columnName: 'tele_fuel', value: blueTeam.teleop_fuel_scored), DataGridCell(columnName: 'auto_pass', value: blueTeam.auto_pass), DataGridCell(columnName: 'tele_pass', value: blueTeam.teleop_pass), ])); @@ -396,8 +396,8 @@ class _StatsTabState extends State<_StatsTab> { double redTelePass = 0; for (var redTeam in stats?.red_teams ?? []) { redOPR += redTeam.OPR; - redAutoFuel += redTeam.auto_fuel_cycles; - redTeleFuel += redTeam.teleop_fuel_cycles; + redAutoFuel += redTeam.auto_fuel_scored; + redTeleFuel += redTeam.teleop_fuel_scored; redAutoPass += redTeam.auto_pass; redTelePass += redTeam.teleop_pass; redRows.add(DataGridRow(cells: [ @@ -405,11 +405,11 @@ class _StatsTabState extends State<_StatsTab> { columnName: 'team_number', value: redTeam.key.substring(3)), DataGridCell(columnName: 'opr', value: redTeam.OPR), DataGridCell( - columnName: 'auto_fuel', value: redTeam.auto_fuel_cycles), + columnName: 'auto_fuel', value: redTeam.auto_fuel_scored), DataGridCell( - columnName: 'tele_fuel', value: redTeam.teleop_fuel_cycles), + columnName: 'tele_fuel', value: redTeam.teleop_fuel_scored), DataGridCell(columnName: 'auto_pass', value: redTeam.auto_pass), - DataGridCell(columnName: 'tele_pass', value: redTeam.teleop_pass), + DataGridCell(columnName: 'teleop_pass', value: redTeam.teleop_pass), ])); } redRows.add(DataGridRow(cells: [ diff --git a/APP/lib/pages/pick_list_page.dart b/APP/lib/pages/pick_list_page.dart index df35912..fe10a18 100644 --- a/APP/lib/pages/pick_list_page.dart +++ b/APP/lib/pages/pick_list_page.dart @@ -155,9 +155,9 @@ class _PicklistPageState extends State { "Auto Pass": (t) => t.auto_pass, "Teleop Pass": (t) => t.teleop_pass, "Climbing Points": (t) => t.climbing_points, - "Auto Fuel Scored": (t) => t.auto_fuel_cycles, - "Teleop Fuel Scored": (t) => t.teleop_fuel_cycles, - "Total Fuel Scored": (t) => t.total_fuel_cycles, + "Auto Fuel Scored": (t) => t.auto_fuel_scored, + "Teleop Fuel Scored": (t) => t.teleop_fuel_scored, + "Total Fuel Scored": (t) => t.total_fuel_scored, "Foul Points": (t) => t.foul_points, "Defense Rate": (t) => t.defense_rate, "Death Rate": (t) => t.death_rate, @@ -2272,11 +2272,11 @@ class _QuickCompareDialogState extends State { _CompareMetric('Auto Pass', a?.auto_pass ?? 0, b?.auto_pass ?? 0), _CompareMetric('Teleop Pass', a?.teleop_pass ?? 0, b?.teleop_pass ?? 0), _CompareMetric( - 'Auto Fuel', a?.auto_fuel_cycles ?? 0, b?.auto_fuel_cycles ?? 0), - _CompareMetric('Teleop Fuel', a?.teleop_fuel_cycles ?? 0, - b?.teleop_fuel_cycles ?? 0), + 'Auto Fuel', a?.auto_fuel_scored ?? 0, b?.auto_fuel_scored ?? 0), _CompareMetric( - 'Total Fuel', a?.total_fuel_cycles ?? 0, b?.total_fuel_cycles ?? 0), + 'Teleop Fuel', a?.teleop_fuel_scored ?? 0, b?.teleop_fuel_scored ?? 0), + _CompareMetric( + 'Total Fuel', a?.total_fuel_scored ?? 0, b?.total_fuel_scored ?? 0), _CompareMetric('Foul Points', a?.foul_points ?? 0, b?.foul_points ?? 0, lowerIsBetter: true), _CompareMetric('Death Rate', a?.death_rate ?? 0, b?.death_rate ?? 0,