From 8988bb5b6110cefc7e37329cc122ae2e46127d89 Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Mon, 11 Nov 2024 18:44:26 +0000 Subject: [PATCH] add cadence/power/heartRate to Point we're not using it for anything yet, just parsing it --- frontend/src/Main.elm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/src/Main.elm b/frontend/src/Main.elm index e7aa545..d7d8b2a 100644 --- a/frontend/src/Main.elm +++ b/frontend/src/Main.elm @@ -43,7 +43,7 @@ type alias TileNumber = { x: Int, y: Int } type alias Lat = Float type alias Lng = Float --- project latling to co-ordinates based on pseudocode at +-- project lat/long to co-ordinates based on pseudocode at -- https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Zoom_levels sec x = 1 / (cos x) @@ -140,6 +140,9 @@ type alias Pos = type alias Point = { time : Float , pos : Pos + , cadence : Maybe Int + , power : Maybe Int + , heartRate : Maybe Int } posDecoder : D.Decoder Pos @@ -150,9 +153,12 @@ posDecoder = D.map3 Pos pointDecoder : D.Decoder Point -pointDecoder = D.map2 Point +pointDecoder = D.map5 Point (D.field "time" D.float) (D.field "pos" posDecoder) + (D.field "cadence" (D.maybe D.int)) + (D.field "power" (D.maybe D.int)) + (D.field "heartRate" (D.maybe D.int)) trackDecoder : D.Decoder (List Point) trackDecoder = D.list pointDecoder