diff --git a/src/Track.elm b/src/Track.elm index 5793f4f..6890f5c 100644 --- a/src/Track.elm +++ b/src/Track.elm @@ -11,6 +11,7 @@ type alias Point = { loc : Position , time : Maybe Time.Posix , power : Maybe Int + , cadence : Maybe Int } type alias Track = List Point @@ -25,11 +26,12 @@ timeDecoder = XD.andThen (\ts -> triple x y z = (x,y,z) -pointDecoder = XD.map3 Point +pointDecoder = XD.map4 Point (XD.map3 triple (floatAttr "lat") (floatAttr "lon") (XD.maybe (path ["ele"] (single XD.float)))) (XD.maybe (path ["time"] (single timeDecoder))) (XD.maybe (path ["extensions", "gpxtpx:TrackPointExtension", "pwr:PowerInWatts"] (single XD.int))) + (XD.maybe (path ["extensions", "gpxtpx:TrackPointExtension", "gpxtpx:cad"] (single XD.int))) gpxDecoder = diff --git a/tests/Fixtures.elm b/tests/Fixtures.elm index 5228a6b..7a63496 100644 --- a/tests/Fixtures.elm +++ b/tests/Fixtures.elm @@ -69,13 +69,18 @@ threepoints_expected = (51.600643, -0.01856, Just 64.8) (Just (Time.millisToPosix 1729669252256)) (Just 89) + (Just 110) ) , (Point (51.600679, -0.018179, Just 65.5) (Just (Time.millisToPosix 1729669255259)) - (Just 86)) + (Just 86) + (Just 111) + ) , (Point (51.600697, -0.018064, Just 66.2) (Just (Time.millisToPosix 1729669256231)) - (Just 86)) + (Just 86) + (Just 111) + ) ]