The departure array is collected in the node_helper by simply adding the different transport methods (buss, train ...) one by one and then do a sort on JourneyDirection. This messes up the ordering by departure time.
Instead create one array for each direction sort these on departure time (if necessary, maybe the API returns in correct order). Then concatenate the direction arrays into one departures array that is sent to the front application for rendering.
The departure array is collected in the node_helper by simply adding the different transport methods (buss, train ...) one by one and then do a sort on JourneyDirection. This messes up the ordering by departure time.
Instead create one array for each direction sort these on departure time (if necessary, maybe the API returns in correct order). Then concatenate the direction arrays into one departures array that is sent to the front application for rendering.