history map: Add checkbox to display manually added journeys
This commit is contained in:
parent
5e03718f14
commit
0e2e8cd78e
3 changed files with 39 additions and 9 deletions
|
@ -3135,6 +3135,7 @@ sub startup {
|
||||||
$authed_r->post('/account/privacy')->to('account#privacy');
|
$authed_r->post('/account/privacy')->to('account#privacy');
|
||||||
$authed_r->post('/account/hooks')->to('account#webhook');
|
$authed_r->post('/account/hooks')->to('account#webhook');
|
||||||
$authed_r->post('/account/insight')->to('account#insight');
|
$authed_r->post('/account/insight')->to('account#insight');
|
||||||
|
$authed_r->post('/history/map')->to('traveling#map_history');
|
||||||
$authed_r->post('/journey/add')->to('traveling#add_journey_form');
|
$authed_r->post('/journey/add')->to('traveling#add_journey_form');
|
||||||
$authed_r->post('/journey/edit')->to('traveling#edit_journey');
|
$authed_r->post('/journey/edit')->to('traveling#edit_journey');
|
||||||
$authed_r->post('/journey/passenger_rights/*filename')
|
$authed_r->post('/journey/passenger_rights/*filename')
|
||||||
|
|
|
@ -434,6 +434,8 @@ sub map_history {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my $include_manual = $self->param('include_manual') ? 1 : 0;
|
||||||
|
|
||||||
my $first_departure = $journeys[-1]->{rt_departure};
|
my $first_departure = $journeys[-1]->{rt_departure};
|
||||||
my $last_departure = $journeys[0]->{rt_departure};
|
my $last_departure = $journeys[0]->{rt_departure};
|
||||||
|
|
||||||
|
@ -453,8 +455,24 @@ sub map_history {
|
||||||
my $to_index = first_index { $_ eq $journey->{to_name} } @route;
|
my $to_index = first_index { $_ eq $journey->{to_name} } @route;
|
||||||
|
|
||||||
if ( $from_index == -1
|
if ( $from_index == -1
|
||||||
or $to_index == -1
|
or $to_index == -1 )
|
||||||
or $journey->{edited} == 0x3fff )
|
{
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Manual journey entries are only included if one of the following
|
||||||
|
# conditions is satisfied:
|
||||||
|
# * their route has more than two elements (-> probably more than just
|
||||||
|
# start and stop station), or
|
||||||
|
# * $include_manual is true (-> user wants to see incomplete routes)
|
||||||
|
# This avoids messing up the map in case an A -> B connection has been
|
||||||
|
# tracked both with a regular checkin (-> detailed route shown on map)
|
||||||
|
# and entered manually (-> beeline also shown on map, typically
|
||||||
|
# significantly differs from detailed route) -- unless the user
|
||||||
|
# sets include_manual, of course.
|
||||||
|
if ( $journey->{edited} & 0x0010
|
||||||
|
and @route <= 2
|
||||||
|
and not $include_manual )
|
||||||
{
|
{
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,11 +10,22 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
%= include '_map', station_coordinates => $station_coordinates, station_pairs => $station_pairs
|
%= include '_map', station_coordinates => $station_coordinates, station_pairs => $station_pairs
|
||||||
%
|
|
||||||
<div class="row">
|
%= form_for '/history/map' => (method => 'POST') => begin
|
||||||
<div class="col s12">
|
%= csrf_field
|
||||||
Bei Zugfahrten mit inkonsistenten Reisedaten und manuellen Einträgen
|
<div class="row">
|
||||||
werden derzeit nur Start- und Zielbahnhof ohne Luftlinie dazwischen
|
<div class="input-field col s12">
|
||||||
angezeigt.
|
<label>
|
||||||
|
%= check_box include_manual => 1
|
||||||
|
<span>Manuelle Einträge ohne Unterwegshalte mitberücksichtigen</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="row">
|
||||||
|
<div class="col s12 center-align">
|
||||||
|
<button class="btn wave-effect waves-light" type="submit" name="action" value="go">
|
||||||
|
Anzeigen
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
%= end
|
||||||
|
|
Loading…
Reference in a new issue