diff options
| author | Daniel Friesel <derf@finalrewind.org> | 2019-05-11 15:23:29 +0200 | 
|---|---|---|
| committer | Daniel Friesel <derf@finalrewind.org> | 2019-05-11 15:23:29 +0200 | 
| commit | 0f28fdfb858fc4cfb6278065442357d51ba233f3 (patch) | |
| tree | 70a817833d71c645c9bce939513fea06ba3deafb | |
| parent | c77a7d2cd2a71b879c96f9dbddfd062c40d96824 (diff) | |
get_journey_stats: Support uid override, fix uninitialized value warning
| -rwxr-xr-x | lib/Travelynx.pm | 9 | 
1 files changed, 6 insertions, 3 deletions
| diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm index 001a762..3284418 100755 --- a/lib/Travelynx.pm +++ b/lib/Travelynx.pm @@ -1309,7 +1309,7 @@ sub startup {  				return {};  			} -			my $uid   = $self->current_user->{id}; +			my $uid   = $opt{uid} // $self->current_user->{id};  			my $year  = $opt{year} // 0;  			my $month = $opt{month} // 0; @@ -1360,6 +1360,7 @@ sub startup {  			}  			my @journeys = $self->get_user_travels( +				uid       => $uid,  				cancelled => $opt{cancelled} ? 1 : 0,  				verbose   => 1,  				after     => $interval_start, @@ -1839,10 +1840,12 @@ sub startup {  				$num_trains++;  				$km_route   += $journey->{km_route};  				$km_beeline += $journey->{km_beeline}; -				if ( $journey->{sched_duration} > 0 ) { +				if (    $journey->{sched_duration} +					and $journey->{sched_duration} > 0 ) +				{  					$min_travel_sched += $journey->{sched_duration} / 60;  				} -				if ( $journey->{rt_duration} > 0 ) { +				if ( $journey->{rt_duration} and $journey->{rt_duration} > 0 ) {  					$min_travel_real += $journey->{rt_duration} / 60;  				}  				if ( $journey->{sched_departure} and $journey->{rt_departure} ) | 
