summaryrefslogtreecommitdiff
path: root/lib/Travelynx/Command/database.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-08-13 21:30:59 +0200
committerDaniel Friesel <derf@finalrewind.org>2019-08-13 21:30:59 +0200
commite259a5e5ddce5fea34dace29efa05910fc8f0300 (patch)
treeb862d714e6a925ac48bd617a3ae948c8c95000da /lib/Travelynx/Command/database.pm
parentc9592e3f765911a04e03c4ef5da1cdc7a93f2551 (diff)
Fix beeline distance calculation when start/stop has no geo-coordinates1.8.7
Diffstat (limited to 'lib/Travelynx/Command/database.pm')
-rw-r--r--lib/Travelynx/Command/database.pm18
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/Travelynx/Command/database.pm b/lib/Travelynx/Command/database.pm
index e561373..c52a0a9 100644
--- a/lib/Travelynx/Command/database.pm
+++ b/lib/Travelynx/Command/database.pm
@@ -558,7 +558,7 @@ my @migrations = (
add column messages_new jsonb;
}
);
- my $res = $db->select( 'journeys', [ 'id', 'messages', 'route' ] );
+ my $res = $db->select( 'journeys', [ 'id', 'messages', 'route' ] );
my $json = JSON->new;
for my $journey ( $res->hashes->each ) {
@@ -689,6 +689,22 @@ my @migrations = (
}
);
},
+
+ # v15 -> v16
+ # Beeline distance calculation now also works when departure or arrival
+ # station do not have geo-coordinates (by resorting to the first/last
+ # station in the route which does have geo-coordinates). Previously,
+ # beeline distances were reported as zero in this case. Clear caches
+ # to recalculate total distances per year / month.
+ sub {
+ my ($db) = @_;
+ $db->query(
+ qq{
+ truncate journey_stats;
+ update schema_version set version = 16;
+ }
+ );
+ },
);
sub setup_db {