Commit 940a5d09 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Result: Document ->station accessor, add ->station_uic

Both are useful to determine which sub-station a departure belongs to when
using with_related => 1.
parent 92885f35
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -292,7 +292,7 @@ sub get_station {
}

sub add_result {
	my ( $self, $station, $s ) = @_;
	my ( $self, $station_name, $station_uic, $s ) = @_;

	my $id   = $s->getAttribute('id');
	my $e_tl = ( $s->findnodes( $self->{xp_tl} ) )[0];
@@ -308,7 +308,8 @@ sub add_result {
		classes      => $e_tl->getAttribute('f'),    # D N S F
		train_no     => $e_tl->getAttribute('n'),    # dep number
		type         => $e_tl->getAttribute('c'),    # S/ICE/ERB/...
		station      => $station,
		station      => $station_name,
		station_uic  => $station_uic + 0,            # UIC IDs are numbers
		strptime_obj => $self->{strptime_obj},

		#unknown_o    => $e_tl->getAttribute('o'),    # owner: 03/80/R2/...
@@ -383,7 +384,7 @@ sub get_timetable {

	for my $s ( $xml->findnodes('/timetable/s') ) {

		$self->add_result( $station, $s );
		$self->add_result( $station, $eva, $s );
	}

	return $self;
@@ -426,7 +427,7 @@ sub get_realtime {
		# add_result will return nothing if no ./tl node is present. The ./tl
		# check here is for optimization purposes.
		if ( not $result and ( $s->findnodes( $self->{xp_tl} ) )[0] ) {
			$result = $self->add_result( $station, $s );
			$result = $self->add_result( $station, $eva, $s );
			if ($result) {
				$result->set_unscheduled(1);
			}
+12 −2
Original line number Diff line number Diff line
@@ -111,11 +111,13 @@ Travel::Status::DE::IRIS::Result->mk_ro_accessors(
	qw(arrival arrival_delay arrival_is_additional arrival_is_cancelled
	  date datetime delay
	  departure departure_delay departure_is_additional departure_is_cancelled
	  is_transfer is_unscheduled is_wing
	  ds100 is_transfer is_unscheduled is_wing
	  line_no old_train_id old_train_no platform raw_id
	  realtime_xml route_start route_end
	  sched_arrival sched_departure sched_platform sched_route_start
	  sched_route_end start stop_no time train_id train_no transfer type
	  sched_route_end start
	  station station_uic
	  stop_no time train_id train_no transfer type
	  unknown_t unknown_o wing_id)
);

@@ -1129,6 +1131,14 @@ Name of the first station served by this train according to its schedule.
DateTime(3pm) object for the scheduled start of the train on its route
(i.e. the departure time at its first station).

=item $result->station

Name of the station this train result belongs to.

=item $result->station_uic

UIC number of the station this train result belongs to.

=item $result->stop_no

Number of this stop on the train's route. 1 if it's the start station, 2