diff options
author | Daniel Friesel <derf@finalrewind.org> | 2022-12-29 14:14:12 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2022-12-29 14:14:12 +0100 |
commit | ccc93413a28d03fd3d2ccf2d86831ad00c77cfe2 (patch) | |
tree | b291c9a5034a7a09d87d97d536900f1811084d99 /lib/Travelynx/Model | |
parent | 09463d7d1156d7a4e17c018fbe8aac3bddc207e7 (diff) |
review: link to list of all single-trip checkins1.29.1
Diffstat (limited to 'lib/Travelynx/Model')
-rwxr-xr-x | lib/Travelynx/Model/Journeys.pm | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Travelynx/Model/Journeys.pm b/lib/Travelynx/Model/Journeys.pm index 1adf95e..f23c2b1 100755 --- a/lib/Travelynx/Model/Journeys.pm +++ b/lib/Travelynx/Model/Journeys.pm @@ -1039,6 +1039,22 @@ sub get_travel_distance { $distance_beeline, $skipped ); } +sub grep_single { + my ( $self, @journeys ) = @_; + + my %num_by_trip; + for my $journey (@journeys) { + if ( $journey->{from_name} and $journey->{to_name} ) { + $num_by_trip{ $journey->{from_name} . '|' . $journey->{to_name} } + += 1; + } + } + + return + grep { $num_by_trip{ $_->{from_name} . '|' . $_->{to_name} } == 1 } + @journeys; +} + sub compute_review { my ( $self, $stats, @journeys ) = @_; my $longest_km; |