ctucx.git: oeffisearch

[nimlang] fast and simple tripplanner

commit 1463652396f9a51fde5a4fdab2ee7c5978d5b2dd
parent 5a4147cfa0d21bc6be036f3c23aa3c2868bd7441
Author: Milan Pässler <me@pbb.lc>
Date: Sat, 8 Feb 2020 00:22:36 +0100

backend/hafas: also combine first walking leg
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/backend/hafas/api/refresh_journey.nim b/src/backend/hafas/api/refresh_journey.nim
@@ -21,4 +21,5 @@ proc refreshJourney*(params: RefreshJourneyParams): Future[Journey] {.async.} =
   }
 
   let data = await request(req)
+  echo pretty data
   return parseJourneysResponse(data, true).journeys[0]
diff --git a/src/backend/hafas/parse/journey.nim b/src/backend/hafas/parse/journey.nim
@@ -13,7 +13,7 @@ proc mkParseJourney*(common: CommonData): proc =
     result.lastUpdated = common.timeStamp
 
     # combine walking legs
-    var i = 0
+    var i = -1
     var firstWalking = -1
     while true:
       inc(i)

@@ -21,8 +21,6 @@ proc mkParseJourney*(common: CommonData): proc =
       if result.legs[i].isWalking:
         if firstWalking == -1:
           firstWalking = i
-          continue
-
         else:
           result.legs[firstWalking].arrival = result.legs[i].arrival
           result.legs[firstWalking].distance.get += result.legs[i].distance.get