summaryrefslogtreecommitdiff
path: root/lib/Travelynx/Model
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Travelynx/Model')
-rw-r--r--lib/Travelynx/Model/InTransit.pm12
-rwxr-xr-xlib/Travelynx/Model/Journeys.pm6
2 files changed, 17 insertions, 1 deletions
diff --git a/lib/Travelynx/Model/InTransit.pm b/lib/Travelynx/Model/InTransit.pm
index 0d548c3..09f682f 100644
--- a/lib/Travelynx/Model/InTransit.pm
+++ b/lib/Travelynx/Model/InTransit.pm
@@ -102,6 +102,8 @@ sub add {
my $json = JSON->new;
if ($train) {
+ my $backend_id
+ = $db->select( 'backends', ['id'], { iris => 1 } )->hash->{id};
$db->insert(
'in_transit',
{
@@ -127,10 +129,19 @@ sub add {
: 0
}
),
+ backend_id => $backend_id,
}
);
}
elsif ( $journey and $stop ) {
+ my $backend_id = $db->select(
+ 'backends',
+ ['id'],
+ {
+ hafas => 1,
+ name => 'DB'
+ }
+ )->hash->{id};
my @route;
my $product = $journey->product_at( $stop->loc->eva )
// $journey->product;
@@ -173,6 +184,7 @@ sub add {
real_departure => $stop->{rt_dep} // $stop->{sched_dep},
route => $json->encode( \@route ),
data => JSON->new->encode( { rt => $stop->{rt_dep} ? 1 : 0 } ),
+ backend_id => $backend_id,
}
);
}
diff --git a/lib/Travelynx/Model/Journeys.pm b/lib/Travelynx/Model/Journeys.pm
index 97c4681..280922b 100755
--- a/lib/Travelynx/Model/Journeys.pm
+++ b/lib/Travelynx/Model/Journeys.pm
@@ -218,6 +218,7 @@ sub add {
edited => 0x3fff,
cancelled => $opt{cancelled} ? 1 : 0,
route => JSON->new->encode( \@route ),
+ backend_id => 1,
};
if ( $opt{comment} ) {
@@ -515,7 +516,7 @@ sub get {
my @select
= (
- qw(journey_id train_type train_line train_no checkin_ts sched_dep_ts real_dep_ts dep_eva dep_ds100 dep_name dep_lat dep_lon checkout_ts sched_arr_ts real_arr_ts arr_eva arr_ds100 arr_name arr_lat arr_lon cancelled edited route messages user_data visibility effective_visibility)
+ qw(journey_id is_iris is_hafas backend_name train_type train_line train_no checkin_ts sched_dep_ts real_dep_ts dep_eva dep_ds100 dep_name dep_lat dep_lon checkout_ts sched_arr_ts real_arr_ts arr_eva arr_ds100 arr_name arr_lat arr_lon cancelled edited route messages user_data visibility effective_visibility)
);
my %where = (
user_id => $uid,
@@ -573,6 +574,9 @@ sub get {
my $ref = {
id => $entry->{journey_id},
+ is_iris => $entry->{is_iris},
+ is_hafas => $entry->{is_hafas},
+ backend_name => $entry->{backend_name},
type => $entry->{train_type},
line => $entry->{train_line},
no => $entry->{train_no},