scouting: Add "defense received" and "comments" to the database
This patch makes it so the webserver saves the "defense received" and
"comment" fields to the database.
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: I3a76518095f7b38360b5c43ae3a117215244c3da
diff --git a/scouting/webserver/requests/debug/cli/cli_test.py b/scouting/webserver/requests/debug/cli/cli_test.py
index 718b2ce..5b0c749 100644
--- a/scouting/webserver/requests/debug/cli/cli_test.py
+++ b/scouting/webserver/requests/debug/cli/cli_test.py
@@ -75,7 +75,9 @@
"upper_goal_tele": 14,
"lower_goal_tele": 15,
"defense_rating": 3,
+ "defense_received_rating": 4,
"climb_level": "Medium",
+ "comment": "A very inspiring and useful comment",
})
exit_code, _, stderr = run_debug_cli(["-submitDataScouting", json_path])
self.assertEqual(exit_code, 0, stderr)
@@ -104,7 +106,9 @@
AutoBall4: (bool) false,
AutoBall5: (bool) true,
StartingQuadrant: (int32) 3,
- ClimbLevel: (request_data_scouting_response.ClimbLevel) Medium
+ ClimbLevel: (request_data_scouting_response.ClimbLevel) Medium,
+ DefenseReceivedRating: (int32) 4,
+ Comment: (string) (len=35) "A very inspiring and useful comment"
}"""), stdout)
def test_request_all_matches(self):
diff --git a/scouting/webserver/requests/messages/request_data_scouting_response.fbs b/scouting/webserver/requests/messages/request_data_scouting_response.fbs
index d85dfbb..3987d7e 100644
--- a/scouting/webserver/requests/messages/request_data_scouting_response.fbs
+++ b/scouting/webserver/requests/messages/request_data_scouting_response.fbs
@@ -24,6 +24,7 @@
upper_goal_tele:int (id:6);
lower_goal_tele:int (id:7);
defense_rating:int (id:8);
+ defense_received_rating:int (id:18);
climbing:int (id:9, deprecated);
climb_level:ClimbLevel (id:17);
@@ -38,6 +39,8 @@
// The quadrant that the robot starts in for autonomous mode.
// Valid values are 1 through 4.
starting_quadrant: int (id:16);
+
+ comment:string (id:19);
}
table RequestDataScoutingResponse {
diff --git a/scouting/webserver/requests/requests.go b/scouting/webserver/requests/requests.go
index 118fafb..2554941 100644
--- a/scouting/webserver/requests/requests.go
+++ b/scouting/webserver/requests/requests.go
@@ -149,15 +149,17 @@
request.AutoBall1(), request.AutoBall2(), request.AutoBall3(),
request.AutoBall4(), request.AutoBall5(),
},
- ShotsMissedAuto: request.MissedShotsAuto(),
- UpperGoalAuto: request.UpperGoalAuto(),
- LowerGoalAuto: request.LowerGoalAuto(),
- ShotsMissed: request.MissedShotsTele(),
- UpperGoalShots: request.UpperGoalTele(),
- LowerGoalShots: request.LowerGoalTele(),
- PlayedDefense: request.DefenseRating(),
- Climbing: int32(request.ClimbLevel()),
- CollectedBy: username,
+ ShotsMissedAuto: request.MissedShotsAuto(),
+ UpperGoalAuto: request.UpperGoalAuto(),
+ LowerGoalAuto: request.LowerGoalAuto(),
+ ShotsMissed: request.MissedShotsTele(),
+ UpperGoalShots: request.UpperGoalTele(),
+ LowerGoalShots: request.LowerGoalTele(),
+ PlayedDefense: request.DefenseRating(),
+ DefenseReceivedScore: request.DefenseReceivedRating(),
+ Climbing: int32(request.ClimbLevel()),
+ CollectedBy: username,
+ Comment: string(request.Comment()),
}
// Do some error checking.
@@ -329,23 +331,25 @@
var response RequestDataScoutingResponseT
for _, stat := range stats {
response.StatsList = append(response.StatsList, &request_data_scouting_response.StatsT{
- Team: stat.TeamNumber,
- Match: stat.MatchNumber,
- StartingQuadrant: stat.StartingQuadrant,
- AutoBall1: stat.AutoBallPickedUp[0],
- AutoBall2: stat.AutoBallPickedUp[1],
- AutoBall3: stat.AutoBallPickedUp[2],
- AutoBall4: stat.AutoBallPickedUp[3],
- AutoBall5: stat.AutoBallPickedUp[4],
- MissedShotsAuto: stat.ShotsMissedAuto,
- UpperGoalAuto: stat.UpperGoalAuto,
- LowerGoalAuto: stat.LowerGoalAuto,
- MissedShotsTele: stat.ShotsMissed,
- UpperGoalTele: stat.UpperGoalShots,
- LowerGoalTele: stat.LowerGoalShots,
- DefenseRating: stat.PlayedDefense,
- ClimbLevel: request_data_scouting_response.ClimbLevel(stat.Climbing),
- CollectedBy: stat.CollectedBy,
+ Team: stat.TeamNumber,
+ Match: stat.MatchNumber,
+ StartingQuadrant: stat.StartingQuadrant,
+ AutoBall1: stat.AutoBallPickedUp[0],
+ AutoBall2: stat.AutoBallPickedUp[1],
+ AutoBall3: stat.AutoBallPickedUp[2],
+ AutoBall4: stat.AutoBallPickedUp[3],
+ AutoBall5: stat.AutoBallPickedUp[4],
+ MissedShotsAuto: stat.ShotsMissedAuto,
+ UpperGoalAuto: stat.UpperGoalAuto,
+ LowerGoalAuto: stat.LowerGoalAuto,
+ MissedShotsTele: stat.ShotsMissed,
+ UpperGoalTele: stat.UpperGoalShots,
+ LowerGoalTele: stat.LowerGoalShots,
+ DefenseRating: stat.PlayedDefense,
+ DefenseReceivedRating: stat.DefenseReceivedScore,
+ ClimbLevel: request_data_scouting_response.ClimbLevel(stat.Climbing),
+ CollectedBy: stat.CollectedBy,
+ Comment: stat.Comment,
})
}
diff --git a/scouting/webserver/requests/requests_test.go b/scouting/webserver/requests/requests_test.go
index 8165c7d..b864cf3 100644
--- a/scouting/webserver/requests/requests_test.go
+++ b/scouting/webserver/requests/requests_test.go
@@ -82,22 +82,24 @@
builder := flatbuffers.NewBuilder(1024)
builder.Finish((&submit_data_scouting.SubmitDataScoutingT{
- Team: 971,
- Match: 1,
- StartingQuadrant: 2,
- AutoBall1: true,
- AutoBall2: false,
- AutoBall3: false,
- AutoBall4: false,
- AutoBall5: false,
- MissedShotsAuto: 9971,
- UpperGoalAuto: 9971,
- LowerGoalAuto: 9971,
- MissedShotsTele: 9971,
- UpperGoalTele: 9971,
- LowerGoalTele: 9971,
- DefenseRating: 9971,
- ClimbLevel: submit_data_scouting.ClimbLevelLow,
+ Team: 971,
+ Match: 1,
+ StartingQuadrant: 2,
+ AutoBall1: true,
+ AutoBall2: false,
+ AutoBall3: false,
+ AutoBall4: false,
+ AutoBall5: false,
+ MissedShotsAuto: 9971,
+ UpperGoalAuto: 9971,
+ LowerGoalAuto: 9971,
+ MissedShotsTele: 9971,
+ UpperGoalTele: 9971,
+ LowerGoalTele: 9971,
+ DefenseRating: 9971,
+ DefenseReceivedRating: 4,
+ ClimbLevel: submit_data_scouting.ClimbLevelLow,
+ Comment: "this is a comment",
}).Pack(builder))
response, err := debug.SubmitDataScouting("http://localhost:8080", builder.FinishedBytes())
@@ -231,8 +233,8 @@
AutoBallPickedUp: [5]bool{true, false, false, false, true},
ShotsMissed: 1, UpperGoalShots: 2, LowerGoalShots: 3,
ShotsMissedAuto: 4, UpperGoalAuto: 5, LowerGoalAuto: 6,
- PlayedDefense: 7, Climbing: 2,
- CollectedBy: "john",
+ PlayedDefense: 7, DefenseReceivedScore: 3, Climbing: 2,
+ Comment: "a lovely comment", CollectedBy: "john",
},
{
TeamNumber: 972, MatchNumber: 1,
@@ -240,8 +242,8 @@
AutoBallPickedUp: [5]bool{false, false, true, false, false},
ShotsMissed: 2, UpperGoalShots: 3, LowerGoalShots: 4,
ShotsMissedAuto: 5, UpperGoalAuto: 6, LowerGoalAuto: 7,
- PlayedDefense: 8, Climbing: 4,
- CollectedBy: "andrea",
+ PlayedDefense: 8, DefenseReceivedScore: 1, Climbing: 4,
+ Comment: "another lovely comment", CollectedBy: "andrea",
},
},
}
@@ -264,23 +266,27 @@
Team: 971, Match: 1,
MissedShotsAuto: 4, UpperGoalAuto: 5, LowerGoalAuto: 6,
MissedShotsTele: 1, UpperGoalTele: 2, LowerGoalTele: 3,
- DefenseRating: 7,
- CollectedBy: "john",
- AutoBall1: true, AutoBall2: false, AutoBall3: false,
+ DefenseRating: 7,
+ DefenseReceivedRating: 3,
+ CollectedBy: "john",
+ AutoBall1: true, AutoBall2: false, AutoBall3: false,
AutoBall4: false, AutoBall5: true,
StartingQuadrant: 1,
ClimbLevel: request_data_scouting_response.ClimbLevelFailedWithPlentyOfTime,
+ Comment: "a lovely comment",
},
{
Team: 972, Match: 1,
MissedShotsAuto: 5, UpperGoalAuto: 6, LowerGoalAuto: 7,
MissedShotsTele: 2, UpperGoalTele: 3, LowerGoalTele: 4,
- DefenseRating: 8,
- CollectedBy: "andrea",
- AutoBall1: false, AutoBall2: false, AutoBall3: true,
+ DefenseRating: 8,
+ DefenseReceivedRating: 1,
+ CollectedBy: "andrea",
+ AutoBall1: false, AutoBall2: false, AutoBall3: true,
AutoBall4: false, AutoBall5: false,
StartingQuadrant: 2,
ClimbLevel: request_data_scouting_response.ClimbLevelMedium,
+ Comment: "another lovely comment",
},
},
}