summaryrefslogtreecommitdiff
path: root/lib/Travelynx/Model
diff options
context:
space:
mode:
authorDerf Null <derf@finalrewind.org>2023-06-26 20:53:08 +0200
committerDerf Null <derf@finalrewind.org>2023-06-26 20:53:08 +0200
commit8cb0de1b702eda1c8fb5b6ed795d769822999d75 (patch)
treeaa3a93ab0fd8ebdabb60daef6468bacaa6090cfe /lib/Travelynx/Model
parentf0be693811bdba2f7a1328944c7820353f392cff (diff)
compute effective visibility in database view
Diffstat (limited to 'lib/Travelynx/Model')
-rw-r--r--lib/Travelynx/Model/InTransit.pm16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/Travelynx/Model/InTransit.pm b/lib/Travelynx/Model/InTransit.pm
index 2848e8e..ca3e570 100644
--- a/lib/Travelynx/Model/InTransit.pm
+++ b/lib/Travelynx/Model/InTransit.pm
@@ -147,6 +147,8 @@ sub get {
= $ret->{visibility}
? $visibility_itoa{ $ret->{visibility} }
: 'default';
+ $ret->{effective_visibility_str}
+ = $visibility_itoa{ $ret->{effective_visibility} };
}
return $ret;
@@ -331,13 +333,13 @@ sub unset_arrival_data {
sub update_departure {
my ( $self, %opt ) = @_;
- my $uid = $opt{uid};
- my $db = $opt{db} // $self->{pg}->db;
+ my $uid = $opt{uid};
+ my $db = $opt{db} // $self->{pg}->db;
my $dep_eva = $opt{dep_eva};
my $arr_eva = $opt{arr_eva};
- my $train = $opt{train};
- my $route = $opt{route};
- my $json = JSON->new;
+ my $train = $opt{train};
+ my $route = $opt{route};
+ my $json = JSON->new;
$route = $self->_merge_old_route(
db => $db,
@@ -359,8 +361,8 @@ sub update_departure {
),
},
{
- user_id => $uid,
- train_no => $train->train_no,
+ user_id => $uid,
+ train_no => $train->train_no,
checkin_station_id => $dep_eva,
checkout_station_id => $arr_eva,
}