Skip to content

Commit

Permalink
Merge "Change entry for 2024 scouting"
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Schrader authored and frc971-automation committed Feb 16, 2024
2 parents 92b9d4e + dcadcb6 commit 7d4b98d
Show file tree
Hide file tree
Showing 17 changed files with 336 additions and 318 deletions.
24 changes: 12 additions & 12 deletions scouting/scouting_test.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,34 +84,34 @@ function submitDataScouting(
cy.get('[type="radio"]').first().check();
clickButton('Start Match');

// Pick and Place Cone in Auto.
clickButton('CONE');
clickButton('HIGH');
// Pick and Place Note in Auto.
clickButton('NOTE');
clickButton('AMP');

// Pick and Place Cube in Teleop.
clickButton('Start Teleop');
clickButton('CUBE');
clickButton('LOW');
clickButton('NOTE');
clickButton('AMP AMPLIFIED');

// Robot dead and revive.
clickButton('DEAD');
clickButton('Revive');

// Endgame.
clickButton('Endgame');
cy.contains(/Docked & Engaged/).click();
cy.contains(/Harmony/).click();

clickButton('End Match');
headerShouldBe(teamNumber + ' Review and Submit ');
cy.get('#review_data li')
.eq(0)
.should('have.text', ' Started match at position 1 ');
cy.get('#review_data li').eq(1).should('have.text', ' Picked up kCone ');
cy.get('#review_data li').eq(1).should('have.text', 'Picked up Note');
cy.get('#review_data li')
.last()
.should(
'have.text',
' Ended Match; docked: false, engaged: true, attempted to dock and engage: false '
' Ended Match; park: false, onStage: false, harmony: true, trapNote: false '
);

clickButton('Submit');
Expand Down Expand Up @@ -264,8 +264,8 @@ describe('Scouting app tests', () => {
cy.get('[type="radio"]').first().check();
clickButton('Start Match');

// Pick up cone.
clickButton('CONE');
// Pick up note.
clickButton('NOTE');

// Undo that pick up.
clickButton('UNDO');
Expand All @@ -274,8 +274,8 @@ describe('Scouting app tests', () => {
headerShouldBe('3990 Pickup ');

// Check the same thing but for undoing place.
clickButton('CUBE');
clickButton('MID');
clickButton('NOTE');
clickButton('AMP');
clickButton('UNDO');
headerShouldBe('3990 Place ');
});
Expand Down
4 changes: 3 additions & 1 deletion scouting/webserver/requests/messages/submit_2024_actions.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ table MobilityAction {
mobility:bool (id:0);
}

table PenaltyAction {}
table PenaltyAction {
penalties: int (id:0);
}

table PickupNoteAction {
auto:bool (id:0);
Expand Down
9 changes: 4 additions & 5 deletions scouting/webserver/requests/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,7 @@ func findIndexInList(list []string, comp_level string) (int, error) {
}

func (handler requestAllMatchesHandler) teamHasBeenDataScouted(key MatchAssemblyKey, teamNumber string) (bool, error) {
// TODO change this to reference 2024 stats
stats, err := handler.db.ReturnStats2023ForTeam(
stats, err := handler.db.ReturnStats2024ForTeam(
teamNumber, key.MatchNumber, key.SetNumber, key.CompLevel, false)
if err != nil {
return false, err
Expand Down Expand Up @@ -480,7 +479,7 @@ func ConvertActionsToStat2024(submit2024Actions *submit_2024_actions.Submit2024A
} else if action_type == submit_2024_actions.ActionTypePenaltyAction {
var penaltyAction submit_2024_actions.PenaltyAction
penaltyAction.Init(actionTable.Bytes, actionTable.Pos)
stat.Penalties += 1
stat.Penalties += penaltyAction.Penalties()

} else if action_type == submit_2024_actions.ActionTypePickupNoteAction {
var pick_up_action submit_2024_actions.PickupNoteAction
Expand Down Expand Up @@ -1165,12 +1164,12 @@ func (handler submit2024ActionsHandler) ServeHTTP(w http.ResponseWriter, req *ht

err = handler.db.AddToStats2024(stats)
if err != nil {
respondWithError(w, http.StatusInternalServerError, fmt.Sprint("Failed to submit stats: ", stats, ": ", err))
respondWithError(w, http.StatusInternalServerError, fmt.Sprint("Failed to submit stats2024: ", stats, ": ", err))
return
}

builder := flatbuffers.NewBuilder(50 * 1024)
builder.Finish((&SubmitActionsResponseT{}).Pack(builder))
builder.Finish((&Submit2024ActionsResponseT{}).Pack(builder))
w.Write(builder.FinishedBytes())
}

Expand Down
42 changes: 18 additions & 24 deletions scouting/webserver/requests/requests_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,30 +131,22 @@ func TestRequestAllMatches(t *testing.T) {
},
},
// Pretend that we have some data scouting data.
stats2023: []db.Stats2023{
stats2024: []db.Stats2024{
{
TeamNumber: "5", MatchNumber: 1, SetNumber: 1,
CompLevel: "qm", StartingQuadrant: 3, LowCubesAuto: 10,
MiddleCubesAuto: 1, HighCubesAuto: 1, CubesDroppedAuto: 0,
LowConesAuto: 1, MiddleConesAuto: 2, HighConesAuto: 1,
ConesDroppedAuto: 0, LowCubes: 1, MiddleCubes: 1,
HighCubes: 2, CubesDropped: 1, LowCones: 1,
MiddleCones: 2, HighCones: 0, ConesDropped: 1, SuperchargedPieces: 0,
AvgCycle: 34, Mobility: false, DockedAuto: true, EngagedAuto: true,
BalanceAttemptAuto: false, Docked: false, Engaged: false,
BalanceAttempt: false, CollectedBy: "alex",
PreScouting: false, TeamNumber: "5",
MatchNumber: 1, SetNumber: 1, CompLevel: "qm", StartingQuadrant: 3,
SpeakerAuto: 2, AmpAuto: 4, NotesDroppedAuto: 1, MobilityAuto: true,
Speaker: 0, Amp: 1, SpeakerAmplified: 2, AmpAmplified: 1,
NotesDropped: 0, Penalties: 01, TrapNote: true, AvgCycle: 233,
Park: false, OnStage: true, Harmony: false, CollectedBy: "alex",
},
{
TeamNumber: "973", MatchNumber: 3, SetNumber: 1,
CompLevel: "qm", StartingQuadrant: 1, LowCubesAuto: 0,
MiddleCubesAuto: 1, HighCubesAuto: 1, CubesDroppedAuto: 2,
LowConesAuto: 0, MiddleConesAuto: 0, HighConesAuto: 0,
ConesDroppedAuto: 1, LowCubes: 0, MiddleCubes: 0,
HighCubes: 1, CubesDropped: 0, LowCones: 0,
MiddleCones: 2, HighCones: 1, ConesDropped: 1, SuperchargedPieces: 0,
AvgCycle: 53, Mobility: true, DockedAuto: true, EngagedAuto: false,
BalanceAttemptAuto: false, Docked: false, Engaged: false,
BalanceAttempt: true, CollectedBy: "bob",
PreScouting: false, TeamNumber: "973",
MatchNumber: 3, SetNumber: 1, CompLevel: "qm", StartingQuadrant: 1,
SpeakerAuto: 0, AmpAuto: 2, NotesDroppedAuto: 0, MobilityAuto: false,
Speaker: 0, Amp: 4, SpeakerAmplified: 3, AmpAmplified: 1,
NotesDropped: 0, Penalties: 1, TrapNote: true, AvgCycle: 120,
Park: true, OnStage: false, Harmony: false, CollectedBy: "bob",
},
},
}
Expand Down Expand Up @@ -416,8 +408,10 @@ func TestConvertActionsToStat2024(t *testing.T) {
},
{
ActionTaken: &submit_2024_actions.ActionTypeT{
Type: submit_2024_actions.ActionTypePenaltyAction,
Value: &submit_2024_actions.PenaltyActionT{},
Type: submit_2024_actions.ActionTypePenaltyAction,
Value: &submit_2024_actions.PenaltyActionT{
Penalties: 5,
},
},
Timestamp: 2400,
},
Expand Down Expand Up @@ -485,7 +479,7 @@ func TestConvertActionsToStat2024(t *testing.T) {
MatchNumber: 3, SetNumber: 1, CompLevel: "quals", StartingQuadrant: 2,
SpeakerAuto: 0, AmpAuto: 1, NotesDroppedAuto: 1, MobilityAuto: true,
Speaker: 0, Amp: 0, SpeakerAmplified: 1, AmpAmplified: 1,
NotesDropped: 0, Penalties: 1, TrapNote: false, AvgCycle: 950,
NotesDropped: 0, Penalties: 5, TrapNote: false, AvgCycle: 950,
Park: false, OnStage: false, Harmony: true, CollectedBy: "",
}

Expand Down
4 changes: 2 additions & 2 deletions scouting/www/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ assemble_static_files(
name = "static_files",
app_files = ":app",
pictures = [
"//third_party/y2023/field:pictures",
"//third_party/y2024/field:pictures",
],
replace_prefixes = {
"prod": "",
"dev": "",
"third_party/y2023": "pictures",
"third_party/y2024": "pictures",
},
tags = [
"no-remote-cache",
Expand Down
2 changes: 1 addition & 1 deletion scouting/www/entry/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ng_pkg(
":node_modules/@angular/forms",
"//scouting/webserver/requests/messages:error_response_ts_fbs",
"//scouting/webserver/requests/messages:request_all_matches_response_ts_fbs",
"//scouting/webserver/requests/messages:submit_actions_ts_fbs",
"//scouting/webserver/requests/messages:submit_2024_actions_ts_fbs",
"//scouting/www/rpc",
"@com_github_google_flatbuffers//ts:flatbuffers_ts",
],
Expand Down
11 changes: 3 additions & 8 deletions scouting/www/entry/entry.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,10 @@ button {
touch-action: manipulation;
}

#switchFldbtn {
width: 15%;
display: block;
margin: 0 auto;
box-shadow: 2px 2px 1px #ccc;
max-width: 105px;
text-align: center;
.row ul div span {
padding: 0px;
}

.row ul div span {
input label {
padding: 0px;
}
Loading

0 comments on commit 7d4b98d

Please sign in to comment.