Rework primary keys in the match list scouting database
We don't need a separate ID for the rows in the match list table. We
really just care about a unique combination of `MatchNumber`, `Round`,
and `CompLevel`.
This will make it easier to update an existing match list. We
currently don't support this.
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: I7d42dab7695cfee4844bbb7660ed820bb083b199
diff --git a/scouting/webserver/requests/requests.go b/scouting/webserver/requests/requests.go
index d67f5e9..8132c3d 100644
--- a/scouting/webserver/requests/requests.go
+++ b/scouting/webserver/requests/requests.go
@@ -391,15 +391,14 @@
// Add the match to the database.
err = handler.db.AddToMatch(db.Match{
MatchNumber: int32(match.MatchNumber),
- // TODO(phil): What does Round mean?
- Round: 1,
- CompLevel: match.CompLevel,
- R1: red[0],
- R2: red[1],
- R3: red[2],
- B1: blue[0],
- B2: blue[1],
- B3: blue[2],
+ Round: int32(match.SetNumber),
+ CompLevel: match.CompLevel,
+ R1: red[0],
+ R2: red[1],
+ R3: red[2],
+ B1: blue[0],
+ B2: blue[1],
+ B3: blue[2],
})
if err != nil {
respondWithError(w, http.StatusInternalServerError, fmt.Sprintf(