scouting: Make data scouting RPC eliminations-aware
This patch adds "round" and "comp_level" to the appropriate
flatbuffers so that the web page and the web server can properly
communicate about eliminations matches.
The web page doesn't actually support eliminations matches yet.
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: I798dae12e44bba2fadf66f0063dbc7f660e82b92
diff --git a/scouting/webserver/requests/debug/cli/cli_test.py b/scouting/webserver/requests/debug/cli/cli_test.py
index c4376df..6189284 100644
--- a/scouting/webserver/requests/debug/cli/cli_test.py
+++ b/scouting/webserver/requests/debug/cli/cli_test.py
@@ -62,6 +62,8 @@
json_path = write_json_request({
"team": 100,
"match": 1,
+ "round": 2,
+ "comp_level": "quals",
"starting_quadrant": 3,
"auto_ball_1": True,
"auto_ball_2": False,
@@ -108,7 +110,9 @@
StartingQuadrant: (int32) 3,
ClimbLevel: (request_data_scouting_response.ClimbLevel) Medium,
DefenseReceivedRating: (int32) 4,
- Comment: (string) (len=35) "A very inspiring and useful comment"
+ Comment: (string) (len=35) "A very inspiring and useful comment",
+ Round: (int32) 2,
+ CompLevel: (string) (len=5) "quals"
}"""), 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 3987d7e..9171335 100644
--- a/scouting/webserver/requests/messages/request_data_scouting_response.fbs
+++ b/scouting/webserver/requests/messages/request_data_scouting_response.fbs
@@ -16,6 +16,8 @@
table Stats {
team:int (id: 0);
match:int (id: 1);
+ round:int (id: 20);
+ comp_level:string (id: 21);
missed_shots_auto:int (id: 2);
upper_goal_auto:int (id:3);
diff --git a/scouting/webserver/requests/messages/submit_data_scouting.fbs b/scouting/webserver/requests/messages/submit_data_scouting.fbs
index e136e71..b1ae2b8 100644
--- a/scouting/webserver/requests/messages/submit_data_scouting.fbs
+++ b/scouting/webserver/requests/messages/submit_data_scouting.fbs
@@ -16,6 +16,9 @@
table SubmitDataScouting {
team:int (id: 0);
match:int (id: 1);
+ round:int (id: 19);
+ comp_level:string (id: 20);
+
missed_shots_auto:int (id: 2);
upper_goal_auto:int (id:3);
lower_goal_auto:int (id:4);
diff --git a/scouting/webserver/requests/requests.go b/scouting/webserver/requests/requests.go
index 8132c3d..af52510 100644
--- a/scouting/webserver/requests/requests.go
+++ b/scouting/webserver/requests/requests.go
@@ -144,6 +144,8 @@
stats := db.Stats{
TeamNumber: request.Team(),
MatchNumber: request.Match(),
+ Round: request.Round(),
+ CompLevel: string(request.CompLevel()),
StartingQuadrant: request.StartingQuadrant(),
AutoBallPickedUp: [5]bool{
request.AutoBall1(), request.AutoBall2(), request.AutoBall3(),
@@ -294,6 +296,8 @@
response.StatsList = append(response.StatsList, &request_data_scouting_response.StatsT{
Team: stat.TeamNumber,
Match: stat.MatchNumber,
+ Round: stat.Round,
+ CompLevel: stat.CompLevel,
StartingQuadrant: stat.StartingQuadrant,
AutoBall1: stat.AutoBallPickedUp[0],
AutoBall2: stat.AutoBallPickedUp[1],
diff --git a/scouting/webserver/requests/requests_test.go b/scouting/webserver/requests/requests_test.go
index e2d9219..20af93c 100644
--- a/scouting/webserver/requests/requests_test.go
+++ b/scouting/webserver/requests/requests_test.go
@@ -84,6 +84,8 @@
builder.Finish((&submit_data_scouting.SubmitDataScoutingT{
Team: 971,
Match: 1,
+ Round: 8,
+ CompLevel: "quals",
StartingQuadrant: 2,
AutoBall1: true,
AutoBall2: false,
@@ -228,7 +230,7 @@
db := MockDatabase{
stats: []db.Stats{
{
- TeamNumber: 971, MatchNumber: 1,
+ TeamNumber: 971, MatchNumber: 1, Round: 2, CompLevel: "quals",
StartingQuadrant: 1,
AutoBallPickedUp: [5]bool{true, false, false, false, true},
ShotsMissed: 1, UpperGoalShots: 2, LowerGoalShots: 3,
@@ -237,7 +239,7 @@
Comment: "a lovely comment", CollectedBy: "john",
},
{
- TeamNumber: 972, MatchNumber: 1,
+ TeamNumber: 972, MatchNumber: 1, Round: 4, CompLevel: "extra",
StartingQuadrant: 2,
AutoBallPickedUp: [5]bool{false, false, true, false, false},
ShotsMissed: 2, UpperGoalShots: 3, LowerGoalShots: 4,
@@ -263,7 +265,7 @@
expected := request_data_scouting_response.RequestDataScoutingResponseT{
StatsList: []*request_data_scouting_response.StatsT{
{
- Team: 971, Match: 1,
+ Team: 971, Match: 1, Round: 2, CompLevel: "quals",
MissedShotsAuto: 4, UpperGoalAuto: 5, LowerGoalAuto: 6,
MissedShotsTele: 1, UpperGoalTele: 2, LowerGoalTele: 3,
DefenseRating: 7,
@@ -276,7 +278,7 @@
Comment: "a lovely comment",
},
{
- Team: 972, Match: 1,
+ Team: 972, Match: 1, Round: 4, CompLevel: "extra",
MissedShotsAuto: 5, UpperGoalAuto: 6, LowerGoalAuto: 7,
MissedShotsTele: 2, UpperGoalTele: 3, LowerGoalTele: 4,
DefenseRating: 8,