history: return 404 if no journeys have been logged for requested period

This commit is contained in:
Daniel Friesel 2022-12-26 16:50:39 +01:00
parent 127b40c27a
commit d256a1956a
No known key found for this signature in database
GPG key ID: 100D5BFB5166E005

View file

@ -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,