diff options
author | Daniel Friesel <derf@finalrewind.org> | 2022-12-26 16:50:39 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2022-12-26 16:50:39 +0100 |
commit | d256a1956a265621d799e5df42e53c98a6d2c855 (patch) | |
tree | 7c08802162ba7899620a6777c02713a2d66ab3bc | |
parent | 127b40c27ab07ad15d1876be1baf2170b684d71e (diff) |
history: return 404 if no journeys have been logged for requested period
-rwxr-xr-x | lib/Travelynx/Controller/Traveling.pm | 14 |
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, |