From 0b73e67ef20ca8b4efdcec85148cf92b4358d0cc Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 28 May 2015 12:34:58 +0200 Subject: json_route_diff: fix trailing additional/cancelled handling --- index.pl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/index.pl b/index.pl index 1a89bff..46a9c66 100644 --- a/index.pl +++ b/index.pl @@ -112,25 +112,27 @@ helper 'json_route_diff' => sub { $sched_idx++; } } - while ( $route_idx++ < $#route ) { + while ( $route_idx < $#route ) { push( @json_route, { - name => $route[ $route_idx++ ], + name => $route[ $route_idx ], isAdditional => 1, isCancelled => 0 } ); + $route_idx++; } - while ( $sched_idx++ < $#sched_route ) { + while ( $sched_idx < $#sched_route ) { push( @json_route, { - name => $route[ $route_idx++ ], + name => $sched_route[ $sched_idx ], isAdditional => 0, isCancelled => 1 } ); + $sched_idx++; } return @json_route; }; -- cgit v1.2.3