summaryrefslogtreecommitdiff
path: root/lib/Travelynx/Controller
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2022-12-26 16:50:39 +0100
committerDaniel Friesel <derf@finalrewind.org>2022-12-26 16:50:39 +0100
commitd256a1956a265621d799e5df42e53c98a6d2c855 (patch)
tree7c08802162ba7899620a6777c02713a2d66ab3bc /lib/Travelynx/Controller
parent127b40c27ab07ad15d1876be1baf2170b684d71e (diff)
history: return 404 if no journeys have been logged for requested period
Diffstat (limited to 'lib/Travelynx/Controller')
-rwxr-xr-xlib/Travelynx/Controller/Traveling.pm14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm
index dee6c1f..90f858c 100755
--- a/lib/Travelynx/Controller/Traveling.pm
+++ b/lib/Travelynx/Controller/Traveling.pm
@@ -1473,6 +1473,13 @@ sub yearly_history {
before => $interval_end,
with_datetime => 1
);
+
+ if ( not @journeys ) {
+ $self->render( 'not_found',
+ message => 'Keine Zugfahrten im angefragten Jahr gefunden.' );
+ return;
+ }
+
$stats = $self->journeys->get_stats(
uid => $self->current_user->{id},
year => $year
@@ -1534,6 +1541,13 @@ sub monthly_history {
before => $interval_end,
with_datetime => 1
);
+
+ if ( not @journeys ) {
+ $self->render( 'not_found',
+ message => 'Keine Zugfahrten im angefragten Monat gefunden.' );
+ return;
+ }
+
$stats = $self->journeys->get_stats(
uid => $self->current_user->{id},
year => $year,