Add shuttled and out of field and remove amp amplified.
Signed-off-by: Emily Markova <emily.markova@gmail.com>
Change-Id: I5dc1dc4c7e2b690b725d3b817e597dca5aa6f3c0
diff --git a/scouting/webserver/requests/requests.go b/scouting/webserver/requests/requests.go
index 7d6e98e..8b9c799 100644
--- a/scouting/webserver/requests/requests.go
+++ b/scouting/webserver/requests/requests.go
@@ -451,7 +451,7 @@
stat := db.Stats2024{
PreScouting: submit2024Actions.PreScouting(), TeamNumber: string(submit2024Actions.TeamNumber()), MatchNumber: submit2024Actions.MatchNumber(), SetNumber: submit2024Actions.SetNumber(), CompLevel: string(submit2024Actions.CompLevel()),
StartingQuadrant: 0, SpeakerAuto: 0, AmpAuto: 0, NotesDroppedAuto: 0, MobilityAuto: false,
- Speaker: 0, Amp: 0, SpeakerAmplified: 0, AmpAmplified: 0, NotesDropped: 0, Penalties: 0,
+ Speaker: 0, Amp: 0, SpeakerAmplified: 0, NotesDropped: 0, Shuttled: 0, OutOfField: 0, Penalties: 0,
TrapNote: false, Spotlight: false, AvgCycle: 0, Park: false, OnStage: false, Harmony: false, RobotDied: false, CollectedBy: "",
}
// Loop over all actions.
@@ -498,12 +498,11 @@
}
score_type := place_action.ScoreType()
auto := place_action.Auto()
+ count_in_cycle := true
if score_type == submit_2024_actions.ScoreTypekAMP && auto {
stat.AmpAuto += 1
} else if score_type == submit_2024_actions.ScoreTypekAMP && !auto {
stat.Amp += 1
- } else if score_type == submit_2024_actions.ScoreTypekAMP_AMPLIFIED && !auto {
- stat.AmpAmplified += 1
} else if score_type == submit_2024_actions.ScoreTypekSPEAKER && !auto {
stat.Speaker += 1
} else if score_type == submit_2024_actions.ScoreTypekSPEAKER && auto {
@@ -512,20 +511,32 @@
stat.SpeakerAmplified += 1
} else if score_type == submit_2024_actions.ScoreTypekDROPPED && auto {
stat.NotesDroppedAuto += 1
+ count_in_cycle = false
} else if score_type == submit_2024_actions.ScoreTypekDROPPED && !auto {
stat.NotesDropped += 1
+ count_in_cycle = false
+ } else if score_type == submit_2024_actions.ScoreTypekSHUTTLED {
+ stat.Shuttled += 1
+ count_in_cycle = false
+ } else if score_type == submit_2024_actions.ScoreTypekOUT_OF_FIELD {
+ stat.OutOfField += 1
+ count_in_cycle = false
} else {
return db.Stats2024{}, errors.New(fmt.Sprintf("Got unknown ObjectType/ScoreLevel/Auto combination"))
}
picked_up = false
- if lastPlacedTime != int64(0) {
- // If this is not the first time we place,
- // start counting cycle time. We define cycle
- // time as the time between placements.
- overall_time += int64(action.Timestamp()) - lastPlacedTime
+ if count_in_cycle {
+ // Assuming dropped, shuttled, and out of field
+ // notes are not counted in total cycle time.
+ if lastPlacedTime != int64(0) {
+ // If this is not the first time we place,
+ // start counting cycle time. We define cycle
+ // time as the time between placements.
+ overall_time += int64(action.Timestamp()) - lastPlacedTime
+ }
cycles += 1
+ lastPlacedTime = int64(action.Timestamp())
}
- lastPlacedTime = int64(action.Timestamp())
} else if action_type == submit_2024_actions.ActionTypeEndMatchAction {
var endMatchAction submit_2024_actions.EndMatchAction
endMatchAction.Init(actionTable.Bytes, actionTable.Pos)
@@ -586,8 +597,9 @@
Speaker: stat.Speaker,
Amp: stat.Amp,
SpeakerAmplified: stat.SpeakerAmplified,
- AmpAmplified: stat.AmpAmplified,
NotesDropped: stat.NotesDropped,
+ Shuttled: stat.Shuttled,
+ OutOfField: stat.OutOfField,
Penalties: stat.Penalties,
TrapNote: stat.TrapNote,
Spotlight: stat.Spotlight,