diff --git a/internal/fusion_dance.go b/internal/fusion_dance.go index 5ceb168..0d6a6d9 100644 --- a/internal/fusion_dance.go +++ b/internal/fusion_dance.go @@ -2,8 +2,6 @@ package internal import ( "fmt" - "math" - "github.com/montanaflynn/stats" ) @@ -46,7 +44,7 @@ func CompileMultiMatch(entries ...TeamData) MultiMatch { // TODO: FIX FOR NEW finalData.DriverStation = entries[0].DriverStation - finalData.CycleData = compileCycles(entries) + // finalData.CycleData = compileCycles(entries) // finalData.Pickups = compilePickupPositions(entries) @@ -85,61 +83,62 @@ func compositeScouters(entries []TeamData) string { } // Compiles the cycle data from all matches into one CompositeCycleData -func compileCycles(entries []TeamData) CompositeCycleData { - var finalCycles CompositeCycleData - var allNumCycles []int - for _, entry := range entries { - allNumCycles = append(allNumCycles, GetNumCycles(entry.Cycles)) - } - - for _, cycleNum := range allNumCycles { - if cycleNum != allNumCycles[0] { - finalCycles.HadMismatches = true - } - } - - cycleCompositeTime, hadMismatches := avgCycleTimes(entries) - - finalCycles.AvgCycleTime = cycleCompositeTime - - if hadMismatches { - finalCycles.HadMismatches = true - } - - var massiveBlockOfCycles []Cycle - for _, entry := range entries { - massiveBlockOfCycles = append(massiveBlockOfCycles, entry.Cycles...) - } - - finalCycles.AllCycles = massiveBlockOfCycles - - return finalCycles -} - +// +// func compileCycles(entries []TeamData) CompositeCycleData { +// var finalCycles CompositeCycleData +// var allNumCycles []int +// for _, entry := range entries { +// allNumCycles = append(allNumCycles, GetNumCycles(entry.Cycles)) +// } +// +// for _, cycleNum := range allNumCycles { +// if cycleNum != allNumCycles[0] { +// finalCycles.HadMismatches = true +// } +// } +// +// cycleCompositeTime, hadMismatches := avgCycleTimes(entries) +// +// finalCycles.AvgCycleTime = cycleCompositeTime +// +// if hadMismatches { +// finalCycles.HadMismatches = true +// } +// +// var massiveBlockOfCycles []Cycle +// for _, entry := range entries { +// massiveBlockOfCycles = append(massiveBlockOfCycles, entry.Cycles...) +// } +// +// finalCycles.AllCycles = massiveBlockOfCycles +// +// return finalCycles +// } +// // Averages out the cycle times from all entries, returning this average as well as if there were any times that were outside // of the configured acceptable range -func avgCycleTimes(entries []TeamData) (float64, bool) { - var sum float64 - var count int = 0 - - var allCycles [][]Cycle - - for _, entry := range entries { - allCycles = append(allCycles, entry.Cycles) - entryAvg := GetAvgCycleTimeExclusive(entry.Cycles) - if entryAvg != 0 { - sum += entryAvg - count++ - } - } - - finalAvg := sum / float64(count) - - if math.IsNaN(finalAvg) { - finalAvg = 0 - } - return finalAvg, !CompareCycles(allCycles) -} +// func avgCycleTimes(entries []TeamData) (float64, bool) { +// var sum float64 +// var count int = 0 +// +// var allCycles [][]Cycle +// +// for _, entry := range entries { +// allCycles = append(allCycles, entry.Cycles) +// entryAvg := GetAvgCycleTimeExclusive(entry.Cycles) +// if entryAvg != 0 { +// sum += entryAvg +// count++ +// } +// } +// +// finalAvg := sum / float64(count) +// +// if math.IsNaN(finalAvg) { +// finalAvg = 0 +// } +// return finalAvg, !CompareCycles(allCycles) +// } // Combines the pickup locations from all entries // func compilePickupPositions(entries []TeamData) PickupLocations { diff --git a/internal/json_parser.go b/internal/json_parser.go index fbdb6a9..5657953 100644 --- a/internal/json_parser.go +++ b/internal/json_parser.go @@ -16,7 +16,6 @@ type TeamData struct { Match MatchInfo `json:"match"` Scouter string `json:"scouter"` DriverStation DriverStationData `json:"driverStation"` - Cycles []Cycle `json:"cycles"` // The cycle data Auto AutoData `json:"auto"` Teleop TeleopData `json:"teleop"` diff --git a/internal/sheet_writer.go b/internal/sheet_writer.go index 5a1afc8..8d67db4 100644 --- a/internal/sheet_writer.go +++ b/internal/sheet_writer.go @@ -167,10 +167,10 @@ func WriteTeamDataToLine(teamData TeamData, row int) bool { // TODO: FIX FOR NEW // This is ONE ROW. Each value is a cell in that row. valuesToWrite := []interface{}{ GetDSString(teamData.DriverStation.IsBlue, uint(teamData.DriverStation.Number)), - teamData.Match.Number, // Match Number - teamData.TeamNumber, // Team Number - GetAvgCycleTime(teamData.Cycles), // Avg cycle time - GetNumCycles(teamData.Cycles), // Num Cycles + teamData.Match.Number, // Match Number + teamData.TeamNumber, // Team Number + // GetAvgCycleTime(teamData.Cycles), // Avg cycle time + // GetNumCycles(teamData.Cycles), // Num Cycles GetCollection(teamData.Teleop.Collection), TurnAutoFieldIntoAnAwesomeAndReadableString(teamData.Auto.Field), teamData.Auto.CanAuto, // Had Auto @@ -377,18 +377,18 @@ func WritePitDataToLine(pitData PitScoutingData, row int) bool { // This is ONE ROW. Each value is a cell in that row. valuesToWrite := []interface{}{ - pitData.TeamNumber, //Team Number - pitData.Scouter, //Person/people who pit scouted - pitData.Weight, //The weight of the robot - pitData.AutoNum, //The number of autos they have - pitData.Dynamic, //Whether they have dynamic autos - pitData.Drivetrain, //The type of drivetrain - pitData.GearRatio, //The GearRatio on the top of my head - pitData.Coral, //The position(s) their robot is able to score - pitData.Algae, //The position(s) their robot is able to score - pitData.AlgaeGround, //Whether it can collect algae from the ground - pitData.AlgaeSource, //Whether it can collect algae from the source - pitData.Cycle, //Their cycle time + pitData.TeamNumber, //Team Number + pitData.Scouter, //Person/people who pit scouted + pitData.Weight, //The weight of the robot + pitData.AutoNum, //The number of autos they have + pitData.Dynamic, //Whether they have dynamic autos + pitData.Drivetrain, //The type of drivetrain + pitData.GearRatio, //The GearRatio on the top of my head + pitData.Coral, //The position(s) their robot is able to score + pitData.Algae, //The position(s) their robot is able to score + pitData.AlgaeGround, //Whether it can collect algae from the ground + pitData.AlgaeSource, //Whether it can collect algae from the source + // pitData.Cycle, //Their cycle time pitData.Experience, //The driver's experience pitData.Teleop, //The strategy for teleop?? pitData.Endgame, //The strategy for endgame @@ -423,9 +423,9 @@ func WritePrescoutDataToLine(teamData TeamData, row int) bool { // TODO: FIX FOR // This is ONE ROW. Each value is a cell in that row. valuesToWrite := []interface{}{ GetDSString(teamData.DriverStation.IsBlue, uint(teamData.DriverStation.Number)), - teamData.TeamNumber, // Team Number - GetAvgCycleTime(teamData.Cycles), // Avg cycle time - GetNumCycles(teamData.Cycles), // Num Cycles + teamData.TeamNumber, // Team Number + // GetAvgCycleTime(teamData.Cycles), // Avg cycle time + // GetNumCycles(teamData.Cycles), // Num Cycles teamData.Auto.CanAuto, // Had Auto teamData.Auto.Scores, // Scores in auto