summaryrefslogtreecommitdiff
path: root/lib/Travelynx.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-03-31 19:32:41 +0200
committerDaniel Friesel <derf@finalrewind.org>2019-03-31 19:32:41 +0200
commit3ce1cfc55f03ccb67b3bab13112d4594974552a4 (patch)
tree256d536d98b49b586f357575d7d580ae2cddb7f4 /lib/Travelynx.pm
parent76f6922e825ea4f4f2ca0054bdd29ccd8e9edeca (diff)
Select journeys by ID
Diffstat (limited to 'lib/Travelynx.pm')
-rwxr-xr-xlib/Travelynx.pm14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm
index b8f778a..4487898 100755
--- a/lib/Travelynx.pm
+++ b/lib/Travelynx.pm
@@ -339,7 +339,7 @@ sub startup {
from user_actions
left outer join stations on station_id = stations.id
where user_id = ?
- and (action_time = to_timestamp(?) or action_time = to_timestamp(?))
+ and user_actions.id <= ?
order by action_time desc
limit 2
}
@@ -898,10 +898,9 @@ qq{select * from pending_mails where email = ? and num_tries > 1;}
$query = $self->app->get_last_actions_query;
}
- if ( $opt{checkin_epoch} and $opt{checkout_epoch} ) {
+ if ( $opt{checkout_id} ) {
$query = $self->app->get_journey_actions_query;
- $query->execute( $uid, $opt{checkin_epoch},
- $opt{checkout_epoch} );
+ $query->execute( $uid, $opt{checkout_id});
}
elsif ( $opt{after} and $opt{before} ) {
@@ -960,7 +959,7 @@ qq{select * from pending_mails where email = ? and num_tries > 1;}
if (
$action == $match_actions[0]
or
- ( $opt{checkout_epoch} and $raw_ts == $opt{checkout_epoch} )
+ ( $opt{checkout_id} and not @travels )
)
{
push(
@@ -989,8 +988,7 @@ qq{select * from pending_mails where email = ? and num_tries > 1;}
$action == $match_actions[1]
and $prev_action == $match_actions[0]
)
- or
- ( $opt{checkin_epoch} and $raw_ts == $opt{checkin_epoch} )
+ or $opt{checkout_id}
)
{
my $ref = $travels[-1];
@@ -1041,7 +1039,7 @@ qq{select * from pending_mails where email = ? and num_tries > 1;}
? $ref->{km_beeline} / $kmh_divisor
: -1;
}
- if ( $opt{checkin_epoch}
+ if ( $opt{checkout_id}
and $action
== $self->app->action_type->{cancelled_from} )
{