show select past departures in checkin suggestion list
Previously, for each destination, up to two departures between now and now + 40 minutes were shown. When performing a fresh checkin (i.e., the has not logged a journey in the past few minutes and is not currently checked in), the departure list now additionally contains all departures between now - 5 minutes and now. When checking in from a train (i.e., the user has recently checked out at the station or is still checked in), it additionally contains all departures between arrival time and now. Closes #33
This commit is contained in:
parent
caf97d9cd0
commit
6826c03386
1 changed files with 14 additions and 5 deletions
|
@ -2755,6 +2755,7 @@ sub startup {
|
|||
my $use_history = $self->account_use_history($uid);
|
||||
|
||||
my ( $eva, $exclude_via, $exclude_train_id, $exclude_before );
|
||||
my $now = $self->now->epoch;
|
||||
|
||||
if ( $opt{eva} ) {
|
||||
if ( $use_history & 0x01 ) {
|
||||
|
@ -2776,6 +2777,8 @@ sub startup {
|
|||
}
|
||||
}
|
||||
|
||||
$exclude_before //= $now - 300;
|
||||
|
||||
if ( not $eva ) {
|
||||
return;
|
||||
}
|
||||
|
@ -2790,7 +2793,7 @@ sub startup {
|
|||
return;
|
||||
}
|
||||
|
||||
my $stationboard = $self->get_departures( $eva, 0, 40, 1 );
|
||||
my $stationboard = $self->get_departures( $eva, 10, 40, 1 );
|
||||
if ( $stationboard->{errstr} ) {
|
||||
return;
|
||||
}
|
||||
|
@ -2850,7 +2853,13 @@ sub startup {
|
|||
and List::Util::any { $_ eq $dest } @via )
|
||||
{
|
||||
push( @results, [ $train, $dest ] );
|
||||
|
||||
# Show all past and up to two future departures per destination
|
||||
if ( not $train->departure
|
||||
or $train->departure->epoch >= $now )
|
||||
{
|
||||
$via_count{$dest}++;
|
||||
}
|
||||
next;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue