Periodically refresh the match list for scouting

I've had a few instances where students thought that we didn't support
eliminations matches because they don't show up when first importing
the match list. The eliminations matches are only importable after the
alliance selections.

To work around this, the webserver now periodically imports the latest
match list. This means we don't need anyone to manually use the
"Import Match List" tab on the app anymore. I deleted that tab as
part of this patch.

The new `scouting/webserver/match_list/match_list.go` file is largely
just the code that I deleted from
`scouting/webserver/requests/requests.go`. I.e. it's really just
moving code around. The main difference now is that instead of
`requests.go` handling match list imports,
`scouting/webserver/main.go` now starts a background task to scrape
the match list every 10 minutes or so.

Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: Ic37df45261f03a323069c1b38c4fd9682a9c4a3e
diff --git a/scouting/webserver/main.go b/scouting/webserver/main.go
index 77cc3c4..1811b7f 100644
--- a/scouting/webserver/main.go
+++ b/scouting/webserver/main.go
@@ -14,8 +14,8 @@
 	"time"
 
 	"github.com/frc971/971-Robot-Code/scouting/db"
-	"github.com/frc971/971-Robot-Code/scouting/scraping"
 	"github.com/frc971/971-Robot-Code/scouting/scraping/background"
+	"github.com/frc971/971-Robot-Code/scouting/webserver/match_list"
 	"github.com/frc971/971-Robot-Code/scouting/webserver/rankings"
 	"github.com/frc971/971-Robot-Code/scouting/webserver/requests"
 	"github.com/frc971/971-Robot-Code/scouting/webserver/server"
@@ -120,19 +120,20 @@
 	}
 	defer database.Delete()
 
-	scrapeMatchList := func(year int32, eventCode string) ([]scraping.Match, error) {
-		if *blueAllianceConfigPtr == "" {
-			return nil, errors.New("Cannot scrape TBA's match list without a config file.")
-		}
-		return scraping.GetAllData[[]scraping.Match](year, eventCode, *blueAllianceConfigPtr, "matches")
-	}
-
 	scoutingServer := server.NewScoutingServer()
 	static.ServePages(scoutingServer, *dirPtr)
-	requests.HandleRequests(database, scrapeMatchList, scoutingServer)
+	requests.HandleRequests(database, scoutingServer)
 	scoutingServer.Start(*portPtr)
 	fmt.Println("Serving", *dirPtr, "on port", *portPtr)
 
+	// Since Go doesn't support default arguments, we use 0 and "" to
+	// indicate that we want to source the values from the config.
+
+	matchListScraper := background.BackgroundScraper{}
+	matchListScraper.Start(func() {
+		match_list.GetMatchList(database, 0, "", *blueAllianceConfigPtr)
+	})
+
 	rankingsScraper := background.BackgroundScraper{}
 	rankingsScraper.Start(func() {
 		rankings.GetRankings(database, 0, "", *blueAllianceConfigPtr)
@@ -148,5 +149,6 @@
 	fmt.Println("Shutting down.")
 	scoutingServer.Stop()
 	rankingsScraper.Stop()
+	matchListScraper.Stop()
 	fmt.Println("Successfully shut down.")
 }