summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2023-02-04 22:17:57 +0100
committerDaniel Friesel <derf@finalrewind.org>2023-02-04 22:17:57 +0100
commit3da22fc8f99fcfc910090a9b99b2b690e6269bda (patch)
treec41dcb54e14bb98120367545c658505dab85c101
parent16cdc3d10a5483a7b7005d57590f6059a8433806 (diff)
improve inconsistency list1.29.18
-rw-r--r--lib/Travelynx/Command/database.pm12
-rwxr-xr-xlib/Travelynx/Model/Journeys.pm25
-rw-r--r--templates/_history_stats.html.ep11
3 files changed, 39 insertions, 9 deletions
diff --git a/lib/Travelynx/Command/database.pm b/lib/Travelynx/Command/database.pm
index a42f2f5..407d50a 100644
--- a/lib/Travelynx/Command/database.pm
+++ b/lib/Travelynx/Command/database.pm
@@ -1300,6 +1300,18 @@ my @migrations = (
}
);
},
+
+ # v31 -> v32
+ # travelynx v1.29.18 improves above-mentioned conflict links.
+ sub {
+ my ($db) = @_;
+ $db->query(
+ qq{
+ truncate journey_stats;
+ update schema_version set version = 32;
+ }
+ );
+ },
);
sub sync_stations {
diff --git a/lib/Travelynx/Model/Journeys.pm b/lib/Travelynx/Model/Journeys.pm
index 1239266..2c84181 100755
--- a/lib/Travelynx/Model/Journeys.pm
+++ b/lib/Travelynx/Model/Journeys.pm
@@ -1458,6 +1458,8 @@ sub compute_stats {
my @inconsistencies;
my $next_departure = 0;
+ my $next_id;
+ my $next_train;
for my $journey (@journeys) {
$num_trains++;
@@ -1488,11 +1490,21 @@ sub compute_stats {
if ( $next_departure - $journey->{rt_arr_ts} < 0 ) {
push(
@inconsistencies,
- [
- epoch_to_dt($next_departure)
- ->strftime('%d.%m.%Y %H:%M'),
- $journey->{id}
- ]
+ {
+ conflict => {
+ train => $journey->{type} . ' '
+ . ( $journey->{line} // $journey->{no} ),
+ arr => epoch_to_dt( $journey->{rt_arr_ts} )
+ ->strftime('%d.%m.%Y %H:%M'),
+ id => $journey->{id},
+ },
+ ignored => {
+ train => $next_train,
+ dep => epoch_to_dt($next_departure)
+ ->strftime('%d.%m.%Y %H:%M'),
+ id => $next_id,
+ },
+ }
);
}
else {
@@ -1504,6 +1516,9 @@ sub compute_stats {
$num_journeys++;
}
$next_departure = $journey->{rt_dep_ts};
+ $next_id = $journey->{id};
+ $next_train
+ = $journey->{type} . ' ' . ( $journey->{line} // $journey->{no} ),;
}
my $ret = {
km_route => $km_route,
diff --git a/templates/_history_stats.html.ep b/templates/_history_stats.html.ep
index 4d702a1..7e11ee7 100644
--- a/templates/_history_stats.html.ep
+++ b/templates/_history_stats.html.ep
@@ -6,12 +6,15 @@
<i class="material-icons small right">warning</i>
<span class="card-title">Inkonsistente Reisedaten</span>
<p>
- Die folgenden Abfahrtszeiten liegen vor der Ankunftszeit der
- vorherigen Zugfahrt und wurden bei der Wartezeitberechnung
- ignoriert.
+ Die folgenden Zugfahrten wurden bei der Wartezeitberechnung
+ ignoriert, da ihre Abfahrtszeit vor der Ankunftszeit der
+ vorherigen Zugfahrt liegt. Bei den restlichen Statistken
+ wurden sie mitberücksichtigt.
<ul>
% for my $field (@{$stats->{inconsistencies}}) {
- <li><a href="/journey/<%= $field->[1] %>"><%= $field->[0] %></a></li>
+ <li><a href="/journey/<%= $field->{ignored}{id} %>"><%= $field->{ignored}{train} %> ab <%= $field->{ignored}{dep} %></a>
+ (Konflikt: <a href="/journey/<%= $field->{conflict}{id} %>"><%= $field->{conflict}{train} %> an <%= $field->{conflict}{arr} %>)</a>
+</li>
% }
</ul>
</p>