Skip to content

Commit

Permalink
Go back to int for Altitude
Browse files Browse the repository at this point in the history
  • Loading branch information
janschill committed Jul 24, 2024
1 parent c4d4c13 commit 8035488
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion garmin-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type Address struct {
type Point struct {
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
Altitude float64 `json:"altitude"`
Altitude int `json:"altitude"`
GPSFix int `json:"gpsFix"`
Course float64 `json:"course"`
Speed float64 `json:"speed"`
Expand Down
2 changes: 1 addition & 1 deletion internal/db/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type Event struct {
Status Status
Latitude float64
Longitude float64
Altitude float64
Altitude int
GpsFix int
Course int
Speed int
Expand Down
6 changes: 3 additions & 3 deletions internal/db/sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func CreateTables(filePath string) {
"timeStamp" INTEGER NOT NULL,
"latitude" REAL,
"longitude" REAL,
"altitude" REAL,
"altitude" INTEGER,
"gpsFix" INTEGER,
"course" REAL,
"speed" REAL,
Expand Down Expand Up @@ -127,7 +127,7 @@ func Seed(filePath string) {
}
defer Db.Close()

file, err := os.Open("./data/visited_points.txt")
file, err := os.Open("./data/route_points.txt")
if err != nil {
log.Fatal("Failed to open file:", err)
}
Expand All @@ -154,7 +154,7 @@ func Seed(filePath string) {
}

_, err = Db.Exec("INSERT INTO events(tripId, imei, messageCode, timeStamp, latitude, longitude, altitude, gpsFix, course, speed, autonomous, lowBattery, intervalChange, resetDetected) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
1, "fake-imei", 0, time.Now().Unix(), latitude, longitude, elevation, 0, 0, 0, 0, 0, 0, 0)
1, "fake-imei", 0, time.Now().Unix(), latitude, longitude, int(elevation), 0, 0, 0, 0, 0, 0, 0)
if err != nil {
log.Fatal("Failed to insert into events table:", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/server/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type GarminOutboundPayload struct {
Point struct {
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
Altitude float64 `json:"altitude"`
Altitude int `json:"altitude"`
GpsFix int `json:"gpsFix"`
Course int `json:"course"`
Speed int `json:"speed"`
Expand Down

0 comments on commit 8035488

Please sign in to comment.