Unverified Commit 13396e44 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Add journey->trip_numbers and loc->trip_no accessors

Related to #9
parent 7bbb0141
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ sub new {
			  = reverse sort { $trip_no_ml{$a} <=> $trip_no_ml{$b} }
			  keys %trip_no_ml;
			$ref->{train_no}     = $trip_no_argmax[0];
			$ref->{trip_numbers} = \@trip_no_argmax;
		}
	}

@@ -220,6 +221,12 @@ sub operators {
	return @{ $self->{operators} // [] };
}

sub trip_numbers {
	my ($self) = @_;

	return @{ $self->{trip_numbers} // [] };
}

sub TO_JSON {
	my ($self) = @_;

+4 −1
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ our $VERSION = '0.17';

Travel::Status::DE::DBRIS::Location->mk_ro_accessors(
	qw(eva id lat lon name admin_id products type is_cancelled is_additional is_separation display_priority
	  dep arr sched_dep sched_arr rt_dep rt_arr arr_delay dep_delay delay
	  trip_no dep arr sched_dep sched_arr rt_dep rt_arr arr_delay dep_delay delay
	  platform sched_platform rt_platform
	  occupancy_first occupancy_second occupancy
	)
@@ -76,6 +76,9 @@ sub new {
	if ( $json->{adminID} ) {
		$ref->{admin_id} = $json->{adminID};
	}
	if ( $json->{nummer} ) {
		$ref->{trip_no} = $json->{nummer};
	}

	for my $occupancy ( @{ $json->{auslastungsmeldungen} // [] } ) {
		if ( $occupancy->{klasse} eq 'KLASSE_1' ) {