journey: show distances below 10km with 100m resolution (and <1km with 1m)
This commit is contained in:
parent
434eb5a18d
commit
04c8d7672a
2 changed files with 16 additions and 2 deletions
|
@ -393,6 +393,20 @@ sub startup {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$self->helper(
|
||||||
|
'sprintf_km' => sub {
|
||||||
|
my ( $self, $km ) = @_;
|
||||||
|
|
||||||
|
if ( $km < 1 ) {
|
||||||
|
return sprintf( '%.f m', $km * 1000 );
|
||||||
|
}
|
||||||
|
if ( $km < 10 ) {
|
||||||
|
return sprintf( '%.1f km', $km );
|
||||||
|
}
|
||||||
|
return sprintf( '%.f km', $km );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
$self->helper(
|
$self->helper(
|
||||||
'load_icon' => sub {
|
'load_icon' => sub {
|
||||||
my ( $self, $load ) = @_;
|
my ( $self, $load ) = @_;
|
||||||
|
|
|
@ -130,8 +130,8 @@
|
||||||
<%= numify_skipped_stations($journey->{skip_route}) %><br/>
|
<%= numify_skipped_stations($journey->{skip_route}) %><br/>
|
||||||
% }
|
% }
|
||||||
% if ($journey->{km_route} > 0.1) {
|
% if ($journey->{km_route} > 0.1) {
|
||||||
ca. <%= sprintf('%.f', $journey->{km_route}) %> km
|
ca. <%= sprintf_km($journey->{km_route}) %>
|
||||||
(Luftlinie: <%= sprintf('%.f', $journey->{km_beeline}) %> km)
|
(Luftlinie: <%= sprintf_km($journey->{km_beeline}) %>)
|
||||||
% }
|
% }
|
||||||
% else {
|
% else {
|
||||||
?
|
?
|
||||||
|
|
Loading…
Reference in a new issue