month overview: distinguish between no stats and no journeys
This commit is contained in:
parent
ccfdd8007e
commit
0addce7bff
2 changed files with 6 additions and 4 deletions
|
@ -749,9 +749,9 @@ sub get_months_for_year {
|
|||
month => $row->{month}
|
||||
}
|
||||
)->expand->hash;
|
||||
if ($stats) {
|
||||
$ret[ $row->{month} - 1 ][2] = $stats->{data};
|
||||
}
|
||||
|
||||
# undef -> no journeys for this month; empty hash -> no cached stats
|
||||
$ret[ $row->{month} - 1 ][2] = $stats->{data} // {};
|
||||
}
|
||||
}
|
||||
return @ret;
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
% for my $month (journeys->get_months_for_year(uid => current_user->{id}, year => $year)) {
|
||||
% if (defined $month->[2]) {
|
||||
<a class="collection-item" href="/history/<%= $month->[0] %>"><%= $month->[1] %>
|
||||
<span class="secondary-content"><%= sprintf('%.f', $month->[2]{km_route}) %> km</span>
|
||||
% if (defined $month->[2]{km_route}) {
|
||||
<span class="secondary-content"><%= sprintf('%.f', $month->[2]{km_route}) %> km</span>
|
||||
% }
|
||||
</a>
|
||||
% }
|
||||
% else {
|
||||
|
|
Loading…
Reference in a new issue