scouting: Add database helper to find status for specific match
I am working on letting the scouting app hide matches that are already
scouted. The approach that I'm currently going with involves querying
the database for an individual team's match. This patch adds the
querying functionality.
A future patch will enhance the logic in `requests.go` to add an
additional flag to `RequestAllMatchesResponse`. This flag will tell
the users whether a specific robot in a match has already been
scouted.
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: I7365aee212bc304ab935c7a4c95e5783008ab133
diff --git a/scouting/db/db.go b/scouting/db/db.go
index 75309d9..adf1eae 100644
--- a/scouting/db/db.go
+++ b/scouting/db/db.go
@@ -329,6 +329,15 @@
return stats2023, result.Error
}
+func (database *Database) ReturnStats2023ForTeam(teamNumber string, matchNumber int32, setNumber int32, compLevel string) ([]Stats2023, error) {
+ var stats2023 []Stats2023
+ result := database.
+ Where("team_number = ? AND match_number = ? AND set_number = ? AND comp_level = ?",
+ teamNumber, matchNumber, setNumber, compLevel).
+ Find(&stats2023)
+ return stats2023, result.Error
+}
+
func (database *Database) ReturnRankings() ([]Ranking, error) {
var rankins []Ranking
result := database.Find(&rankins)