summaryrefslogtreecommitdiff
path: root/lib/Travelynx/Controller
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2020-04-19 17:49:14 +0200
committerDaniel Friesel <derf@finalrewind.org>2020-04-19 17:49:14 +0200
commit346f1474bbc1814bdbbd02c79f78f2c1bbaa0b43 (patch)
treea9fc9e7d377c6b06981407432419700a2c0addde /lib/Travelynx/Controller
parent5ce4bc6995da0b49783c15a66075e5e4f1545875 (diff)
commute stats: attempt to weed out non-work stations for auto-fill
Diffstat (limited to 'lib/Travelynx/Controller')
-rwxr-xr-xlib/Travelynx/Controller/Traveling.pm8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm
index 1eef0c8..ae5be69 100755
--- a/lib/Travelynx/Controller/Traveling.pm
+++ b/lib/Travelynx/Controller/Traveling.pm
@@ -534,6 +534,14 @@ sub commute {
elsif ( $dep->dow <= 5 and $dep->hour > 12 ) {
$candidate_count{ $journey->{from_name} }++;
}
+ else {
+ # Avoid selecting an intermediate station for multi-leg commutes.
+ # Assumption: The intermediate station is also used for private
+ # travels -> penalize stations which are used on weekends or at
+ # unexpected times.
+ $candidate_count{ $journey->{from_name} }--;
+ $candidate_count{ $journey->{to_name} }--;
+ }
}
$station = max_by { $candidate_count{$_} } keys %candidate_count;
}