Commit cec9c949 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

sort optimization

parent e37b7d7d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -128,7 +128,7 @@ sub new {
	} @{ $self->{results} };

	@{ $self->{results} }
	  = sort { $a->{datetime} <=> $b->{datetime} } @{ $self->{results} };
	  = sort { $a->{epoch} <=> $b->{epoch} } @{ $self->{results} };

	# wings (different departures which are coupled as one train) contain
	# references to each other. therefore, they must be processed last.
+4 −2
Original line number Diff line number Diff line
@@ -155,6 +155,7 @@ sub new {

	$ref->{date}  = $dt->strftime('%d.%m.%Y');
	$ref->{time}  = $dt->strftime('%H:%M');
	$ref->{epoch} = $dt->epoch;

	$ref->{route_pre} = $ref->{sched_route_pre}
	  = [ split( qr{[|]}, $ref->{route_pre} // q{} ) ];
@@ -432,6 +433,7 @@ sub merge_with_departure {
	# departure is preferred over arrival, so overwrite default values
	$self->{date}     = $result->{date};
	$self->{time}     = $result->{time};
	$self->{epoch}    = $result->{epoch};
	$self->{datetime} = $result->{datetime};
	$self->{train_id} = $result->{train_id};
	$self->{train_no} = $result->{train_no};