aboutsummaryrefslogtreecommitdiff
path: root/internal/webui
diff options
context:
space:
mode:
authorJulien Dessaux2021-09-08 15:23:50 +0200
committerJulien Dessaux2021-09-08 16:12:01 +0200
commit3c5e31b25a53268b413bc1e511b7486a2a1c80b9 (patch)
treef6fe9a82eab8abf7a01f84bce954edc7462f87a2 /internal/webui
parentRemoved useless user model code (diff)
downloadtrains-3c5e31b25a53268b413bc1e511b7486a2a1c80b9.tar.gz
trains-3c5e31b25a53268b413bc1e511b7486a2a1c80b9.tar.bz2
trains-3c5e31b25a53268b413bc1e511b7486a2a1c80b9.zip
Renamed TrainStop to simply Stop
Diffstat (limited to '')
-rw-r--r--internal/webui/root_test.go4
-rw-r--r--internal/webui/webui.go6
2 files changed, 5 insertions, 5 deletions
diff --git a/internal/webui/root_test.go b/internal/webui/root_test.go
index 945f04b..b86bb1c 100644
--- a/internal/webui/root_test.go
+++ b/internal/webui/root_test.go
@@ -12,7 +12,7 @@ import (
type NavitiaMockClient struct {
departures []model.Departure
- trainStops []model.TrainStop
+ trainStops []model.Stop
err error
}
@@ -20,7 +20,7 @@ func (c *NavitiaMockClient) GetDepartures(trainStop string) (departures []model.
return c.departures, c.err
}
-func (c *NavitiaMockClient) GetTrainStops() (trainStops []model.TrainStop, err error) {
+func (c *NavitiaMockClient) GetStops() (trainStops []model.Stop, err error) {
return c.trainStops, c.err
}
diff --git a/internal/webui/webui.go b/internal/webui/webui.go
index 1a251f4..fa59f68 100644
--- a/internal/webui/webui.go
+++ b/internal/webui/webui.go
@@ -19,11 +19,11 @@ func Run(c *config.Config, dbEnv *database.DBEnv) {
http.Handle("/login", handler{&e, loginHandler})
http.Handle("/static/", http.FileServer(http.FS(staticFS)))
- if i, err := dbEnv.CountTrainStops(); err == nil && i == 0 {
+ if i, err := dbEnv.CountStops(); err == nil && i == 0 {
log.Printf("No trains stops data found, updating...")
- if trainStops, err := e.navitia.GetTrainStops(); err == nil {
+ if trainStops, err := e.navitia.GetStops(); err == nil {
log.Printf("Updated trains stops data from navitia api, got %d results", len(trainStops))
- if err = dbEnv.ReplaceAndImportTrainStops(trainStops); err != nil {
+ if err = dbEnv.ReplaceAndImportStops(trainStops); err != nil {
if dberr, ok := err.(*database.QueryError); ok {
log.Printf("%+v", dberr.Unwrap())
}