From d256a1956a265621d799e5df42e53c98a6d2c855 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 26 Dec 2022 16:50:39 +0100 Subject: history: return 404 if no journeys have been logged for requested period --- lib/Travelynx/Controller/Traveling.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib/Travelynx/Controller') 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, -- cgit v1.2.3