Loading lib/Travelynx/Controller/Traveling.pm +14 −0 Original line number Diff line number Diff line Loading @@ -1658,6 +1658,12 @@ sub yearly_history { $with_review = 1; } my %km_by_day; for my $journey (@journeys) { my $mmdd = $journey->{sched_departure}->strftime('%m/%d'); $km_by_day{$mmdd} += $journey->{distance} / 1e3; } $self->respond_to( json => { json => { Loading @@ -1669,6 +1675,7 @@ sub yearly_history { template => 'history_by_year', title => "travelynx: $year", journeys => [@journeys], km_by_day => \%km_by_day, year => $year, have_review => $with_review, statistics => $stats Loading Loading @@ -1734,6 +1741,12 @@ sub monthly_history { my $month_name = $months[ $month - 1 ]; my %km_by_day; for my $journey (@journeys) { my $mmdd = $journey->{sched_departure}->strftime('%m/%d'); $km_by_day{$mmdd} += $journey->{distance} / 1e3; } $self->respond_to( json => { json => { Loading @@ -1745,6 +1758,7 @@ sub monthly_history { template => 'history_by_month', title => "travelynx: $month_name $year", journeys => [@journeys], km_by_day => \%km_by_day, year => $year, month => $month, month_name => $month_name, Loading templates/_history_trains.html.ep +3 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,9 @@ % if ($olddate ne $date) { <li class="collection-item history-date-change"> <b><%= $date %></b> % if (my $km = (stash('km_by_day') // {})->{$travel->{sched_departure}->strftime('%m/%d')}) { <span style="float: right; font-weight: normal;"><%= sprintf('%.f km', $km) %></span> % } </li> % $olddate = $date % } Loading templates/history_by_month.html.ep +1 −1 Original line number Diff line number Diff line Loading @@ -11,5 +11,5 @@ </div> % if (stash('journeys')) { %= include '_history_trains', date_format => '%d.%m.', journeys => stash('journeys'), order => 'asc'; %= include '_history_trains', date_format => '%d.%m.', journeys => stash('journeys'), km_by_day => stash('km_by_day'), order => 'asc'; % } templates/history_by_year.html.ep +1 −1 Original line number Diff line number Diff line Loading @@ -32,5 +32,5 @@ % } % if (stash('journeys')) { %= include '_history_trains', date_format => '%d.%m.', journeys => stash('journeys'), order => 'asc'; %= include '_history_trains', date_format => '%d.%m.', journeys => stash('journeys'), km_by_day => stash('km_by_day'), order => 'asc'; % } Loading
lib/Travelynx/Controller/Traveling.pm +14 −0 Original line number Diff line number Diff line Loading @@ -1658,6 +1658,12 @@ sub yearly_history { $with_review = 1; } my %km_by_day; for my $journey (@journeys) { my $mmdd = $journey->{sched_departure}->strftime('%m/%d'); $km_by_day{$mmdd} += $journey->{distance} / 1e3; } $self->respond_to( json => { json => { Loading @@ -1669,6 +1675,7 @@ sub yearly_history { template => 'history_by_year', title => "travelynx: $year", journeys => [@journeys], km_by_day => \%km_by_day, year => $year, have_review => $with_review, statistics => $stats Loading Loading @@ -1734,6 +1741,12 @@ sub monthly_history { my $month_name = $months[ $month - 1 ]; my %km_by_day; for my $journey (@journeys) { my $mmdd = $journey->{sched_departure}->strftime('%m/%d'); $km_by_day{$mmdd} += $journey->{distance} / 1e3; } $self->respond_to( json => { json => { Loading @@ -1745,6 +1758,7 @@ sub monthly_history { template => 'history_by_month', title => "travelynx: $month_name $year", journeys => [@journeys], km_by_day => \%km_by_day, year => $year, month => $month, month_name => $month_name, Loading
templates/_history_trains.html.ep +3 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,9 @@ % if ($olddate ne $date) { <li class="collection-item history-date-change"> <b><%= $date %></b> % if (my $km = (stash('km_by_day') // {})->{$travel->{sched_departure}->strftime('%m/%d')}) { <span style="float: right; font-weight: normal;"><%= sprintf('%.f km', $km) %></span> % } </li> % $olddate = $date % } Loading
templates/history_by_month.html.ep +1 −1 Original line number Diff line number Diff line Loading @@ -11,5 +11,5 @@ </div> % if (stash('journeys')) { %= include '_history_trains', date_format => '%d.%m.', journeys => stash('journeys'), order => 'asc'; %= include '_history_trains', date_format => '%d.%m.', journeys => stash('journeys'), km_by_day => stash('km_by_day'), order => 'asc'; % }
templates/history_by_year.html.ep +1 −1 Original line number Diff line number Diff line Loading @@ -32,5 +32,5 @@ % } % if (stash('journeys')) { %= include '_history_trains', date_format => '%d.%m.', journeys => stash('journeys'), order => 'asc'; %= include '_history_trains', date_format => '%d.%m.', journeys => stash('journeys'), km_by_day => stash('km_by_day'), order => 'asc'; % }