Add climbing level to database
I spent a lot of time trying to make this use enums for the entire
data path. Unfortunately, I ran into a few issues. Firstly, I couldn't
figure out how make our Go SQL code happy with postgresql enums. I
kept getting errors about `unknown oid`. Secondly, I couldn't figure
out how to de-duplicate the enum between `submit_data_scouting.fbs`
and `request_data_scouting_response.fbs`. The generated Go code
doesn't import the dependency properly.
All this turned into an enum at the flatbuffer and TypeScript level,
but just an integer at the Go/postgres level.
A future patch can deal with this. Perhaps it'd be better to ignore
this altogether and just switch to a library like Gorm.
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: Id6cbb5502fd77f3107514b8d7cb9df2923a9d5f9
diff --git a/scouting/webserver/requests/requests.go b/scouting/webserver/requests/requests.go
index 13d7396..118fafb 100644
--- a/scouting/webserver/requests/requests.go
+++ b/scouting/webserver/requests/requests.go
@@ -156,7 +156,7 @@
UpperGoalShots: request.UpperGoalTele(),
LowerGoalShots: request.LowerGoalTele(),
PlayedDefense: request.DefenseRating(),
- Climbing: request.Climbing(),
+ Climbing: int32(request.ClimbLevel()),
CollectedBy: username,
}
@@ -344,7 +344,7 @@
UpperGoalTele: stat.UpperGoalShots,
LowerGoalTele: stat.LowerGoalShots,
DefenseRating: stat.PlayedDefense,
- Climbing: stat.Climbing,
+ ClimbLevel: request_data_scouting_response.ClimbLevel(stat.Climbing),
CollectedBy: stat.CollectedBy,
})
}