summaryrefslogtreecommitdiff
path: root/lib/Travelynx/Model
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2023-07-15 08:36:26 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2023-07-15 08:36:26 +0200
commitd43c44e81c16ee7a4a2d178a507daa81c35e622a (patch)
treef786f7233b4500c4945f0c71967be1ea2ca6e2a8 /lib/Travelynx/Model
parentca3cd1580fc9de619abbcfde69a1fd117b2d0533 (diff)
add view for followees in transit
Diffstat (limited to 'lib/Travelynx/Model')
-rw-r--r--lib/Travelynx/Model/InTransit.pm32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/Travelynx/Model/InTransit.pm b/lib/Travelynx/Model/InTransit.pm
index e36173d..81d4a24 100644
--- a/lib/Travelynx/Model/InTransit.pm
+++ b/lib/Travelynx/Model/InTransit.pm
@@ -154,6 +154,38 @@ sub get {
return $ret;
}
+sub get_timeline {
+ my ( $self, %opt ) = @_;
+
+ my $uid = $opt{uid};
+ my $db = $opt{db} // $self->{pg}->db;
+
+ my $where = {
+ follower_id => $uid,
+ effective_visibility => { '>=', 30 }
+ };
+
+ if ( $opt{short} ) {
+ return $db->select(
+ 'follows_in_transit',
+ [
+ qw(followee_name train_type train_line train_no dep_eva dep_name arr_eva arr_name)
+ ],
+ $where
+ )->hashes->each;
+ }
+
+ my $res = $db->select( 'follows_in_transit', '*', $where );
+ my $ret;
+
+ if ( $opt{with_data} ) {
+ return $res->expand->hashes->each;
+ }
+ else {
+ return $res->hashes->each;
+ }
+}
+
sub get_all_active {
my ( $self, %opt ) = @_;
my $db = $opt{db} // $self->{pg}->db;