summaryrefslogtreecommitdiff
path: root/lib/Travelynx.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-04-09 18:37:21 +0200
committerDaniel Friesel <derf@finalrewind.org>2019-04-09 18:37:21 +0200
commitbba6721754711446268445044406d74dda01aafc (patch)
tree5153c2e71abf3f3acd47fcfe5fb69ba4dd8b31f7 /lib/Travelynx.pm
parent3ae6bda093d67069ca10cdcc777e27b3b09191b7 (diff)
Allow journey editing, keep track of edited journey attributes0.13
Provides a workaround for #2
Diffstat (limited to 'lib/Travelynx.pm')
-rwxr-xr-xlib/Travelynx.pm18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm
index 337250b..8709c47 100755
--- a/lib/Travelynx.pm
+++ b/lib/Travelynx.pm
@@ -277,7 +277,7 @@ sub startup {
return $self->app->dbh->prepare(
qq{
update user_actions
- set sched_time = to_timestamp(?), edited = 1
+ set sched_time = to_timestamp(?), edited = edited | 1
where id = ? and action_id = ?
}
);
@@ -291,7 +291,7 @@ sub startup {
return $self->app->dbh->prepare(
qq{
update user_actions
- set real_time = to_timestamp(?), edited = 1
+ set real_time = to_timestamp(?), edited = edited | 2
where id = ? and action_id = ?
}
);
@@ -304,12 +304,12 @@ sub startup {
return $self->app->dbh->prepare(
qq{
insert into user_actions (
- user_id, action_id, station_id, action_time,
+ user_id, action_id, station_id, action_time, edited,
train_type, train_line, train_no, train_id,
sched_time, real_time,
route, messages
) values (
- ?, ?, ?, to_timestamp(?),
+ ?, ?, ?, to_timestamp(?), ?
?, ?, ?, ?,
to_timestamp(?), to_timestamp(?),
?, ?
@@ -665,6 +665,7 @@ qq{select * from pending_mails where email = ? and num_tries > 1;}
name => $status->{station_name}
),
DateTime->now( time_zone => 'Europe/Berlin' )->epoch,
+ 0,
$train->type,
$train->line_no,
$train->train_no,
@@ -778,8 +779,8 @@ qq{select * from pending_mails where email = ? and num_tries > 1;}
name => $status->{station_name}
),
$now->epoch,
- undef, undef, undef, undef, undef,
- undef, undef, undef
+ 0, undef, undef, undef, undef,
+ undef, undef, undef, undef
);
if ( defined $success ) {
$self->invalidate_stats_cache;
@@ -807,6 +808,7 @@ qq{select * from pending_mails where email = ? and num_tries > 1;}
name => $status->{station_name}
),
$now->epoch,
+ 0,
$train->type,
$train->line_no,
$train->train_no,
@@ -1289,7 +1291,7 @@ qq{select * from pending_mails where email = ? and num_tries > 1;}
? [ split( qr{[|]}, $raw_route ) ]
: undef,
completed => 0,
- edited => $edited // 0,
+ edited => $edited << 8,
}
);
}
@@ -1313,7 +1315,7 @@ qq{select * from pending_mails where email = ? and num_tries > 1;}
$ref->{no} //= $train_no;
$ref->{messages} //= [ split( qr{[|]}, $raw_messages ) ];
$ref->{route} //= [ split( qr{[|]}, $raw_route ) ];
- $ref->{edited} += $edited;
+ $ref->{edited} |= $edited;
if ( $opt{verbose} ) {
my @parsed_messages;