fix shadowing issue and update TestRequestAllMatches()
err in sort.Slice() was shadowing and resulting in misleading results and TestRequestAllMatches() needed to be updated so that the comp level was noted in blue alliance formatting "qm" rather than as "qual"
Signed-off-by: Emily Markova <emily.markova@gmail.com>
Change-Id: I5d9a31df7eec0c79cdb0453648df4517e4ca7d7c
diff --git a/scouting/webserver/requests/requests.go b/scouting/webserver/requests/requests.go
index 1fc0ae4..fffafb3 100644
--- a/scouting/webserver/requests/requests.go
+++ b/scouting/webserver/requests/requests.go
@@ -310,14 +310,14 @@
a := response.MatchList[i]
b := response.MatchList[j]
- aMatchTypeIndex, err := findIndexInList(MATCH_TYPE_ORDERING, a.CompLevel)
- if err != nil {
- err = errors.New(fmt.Sprint("Comp level ", a.CompLevel, " not found in sorting list ", MATCH_TYPE_ORDERING, " : ", err))
+ aMatchTypeIndex, err2 := findIndexInList(MATCH_TYPE_ORDERING, a.CompLevel)
+ if err2 != nil {
+ err = errors.New(fmt.Sprint("Comp level ", a.CompLevel, " not found in sorting list ", MATCH_TYPE_ORDERING, " : ", err2))
return false
}
- bMatchTypeIndex, err := findIndexInList(MATCH_TYPE_ORDERING, b.CompLevel)
- if err != nil {
- err = errors.New(fmt.Sprint("Comp level ", b.CompLevel, " not found in sorting list ", MATCH_TYPE_ORDERING, " : ", err))
+ bMatchTypeIndex, err2 := findIndexInList(MATCH_TYPE_ORDERING, b.CompLevel)
+ if err2 != nil {
+ err = errors.New(fmt.Sprint("Comp level ", b.CompLevel, " not found in sorting list ", MATCH_TYPE_ORDERING, " : ", err2))
return false
}