summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rwxr-xr-xlib/Travelynx.pm17
-rw-r--r--lib/Travelynx/Command/database.pm14
2 files changed, 30 insertions, 1 deletions
diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm
index 32b6b6d..a5dbcb8 100755
--- a/lib/Travelynx.pm
+++ b/lib/Travelynx.pm
@@ -2781,7 +2781,7 @@ sub startup {
}
$next_departure = $journey->{rt_dep_ts};
}
- return {
+ my $ret = {
km_route => $km_route,
km_beeline => $km_beeline,
num_trains => $num_trains,
@@ -2793,6 +2793,21 @@ sub startup {
delay_arr => $delay_arr,
inconsistencies => \@inconsistencies,
};
+ for my $key (
+ qw(min_travel_sched min_travel_real min_interchange_real delay_dep delay_arr)
+ )
+ {
+ my $strf_key = $key . '_strf';
+ my $value = $ret->{$key};
+ $ret->{$strf_key} = q{};
+ if ( $ret->{$key} < 0 ) {
+ $ret->{$strf_key} .= '-';
+ $value *= -1;
+ }
+ $ret->{$strf_key}
+ .= sprintf( '%02d:%02d', $value / 60, $value % 60 );
+ }
+ return $ret;
}
);
diff --git a/lib/Travelynx/Command/database.pm b/lib/Travelynx/Command/database.pm
index e92dd4b..a257b8b 100644
--- a/lib/Travelynx/Command/database.pm
+++ b/lib/Travelynx/Command/database.pm
@@ -1038,6 +1038,20 @@ my @migrations = (
}
);
},
+
+ # v22 -> v23
+ # 1.18.1 fixes handling of negative cumulative arrival/departure delays
+ # and introduces additional statistics entries with pre-formatted duration
+ # strings while at it. Old cache entries lack those.
+ sub {
+ my ($db) = @_;
+ $db->query(
+ qq{
+ truncate journey_stats;
+ update schema_version set version = 23;
+ }
+ );
+ },
);
sub setup_db {