summaryrefslogtreecommitdiff
path: root/lib/Travelynx/Controller/Traveling.pm
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2019-11-27 18:26:15 +0100
committerDaniel Friesel <daniel.friesel@uos.de>2019-11-27 18:26:15 +0100
commit0e2e8cd78ef8dce5bed07187d3cda09dc2c5a103 (patch)
treefee5f712395856cd97a0fe62feb6f682704c2cdc /lib/Travelynx/Controller/Traveling.pm
parent5e03718f14e9d8888a3bd0407828abf01beeda96 (diff)
history map: Add checkbox to display manually added journeys
Diffstat (limited to 'lib/Travelynx/Controller/Traveling.pm')
-rwxr-xr-xlib/Travelynx/Controller/Traveling.pm22
1 files changed, 20 insertions, 2 deletions
diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm
index 56de0fb..c8ba024 100755
--- a/lib/Travelynx/Controller/Traveling.pm
+++ b/lib/Travelynx/Controller/Traveling.pm
@@ -434,6 +434,8 @@ sub map_history {
return;
}
+ my $include_manual = $self->param('include_manual') ? 1 : 0;
+
my $first_departure = $journeys[-1]->{rt_departure};
my $last_departure = $journeys[0]->{rt_departure};
@@ -453,8 +455,24 @@ sub map_history {
my $to_index = first_index { $_ eq $journey->{to_name} } @route;
if ( $from_index == -1
- or $to_index == -1
- or $journey->{edited} == 0x3fff )
+ or $to_index == -1 )
+ {
+ next;
+ }
+
+ # Manual journey entries are only included if one of the following
+ # conditions is satisfied:
+ # * their route has more than two elements (-> probably more than just
+ # start and stop station), or
+ # * $include_manual is true (-> user wants to see incomplete routes)
+ # This avoids messing up the map in case an A -> B connection has been
+ # tracked both with a regular checkin (-> detailed route shown on map)
+ # and entered manually (-> beeline also shown on map, typically
+ # significantly differs from detailed route) -- unless the user
+ # sets include_manual, of course.
+ if ( $journey->{edited} & 0x0010
+ and @route <= 2
+ and not $include_manual )
{
next;
}