Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
travelynx
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
derf
travelynx
Commits
d43c44e8
Unverified
Commit
d43c44e8
authored
1 year ago
by
Birte Kristina Friesel
Browse files
Options
Downloads
Patches
Plain Diff
add view for followees in transit
parent
ca3cd158
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/Travelynx/Command/database.pm
+44
-0
44 additions, 0 deletions
lib/Travelynx/Command/database.pm
lib/Travelynx/Model/InTransit.pm
+32
-0
32 additions, 0 deletions
lib/Travelynx/Model/InTransit.pm
with
76 additions
and
0 deletions
lib/Travelynx/Command/database.pm
+
44
−
0
View file @
d43c44e8
...
...
@@ -1717,6 +1717,50 @@ my @migrations = (
}
);
},
# v41 -> v42
# adds current followee checkins
sub
{
my
(
$db
)
=
@_
;
$db
->
query
(
qq{
create view follows_in_transit as select
r1.subject_id as follower_id, user_id as followee_id,
users.name as followee_name,
train_type, train_line, train_no, train_id,
extract(epoch from checkin_time) as checkin_ts,
extract(epoch from sched_departure) as sched_dep_ts,
extract(epoch from real_departure) as real_dep_ts,
checkin_station_id as dep_eva,
dep_station.ds100 as dep_ds100,
dep_station.name as dep_name,
dep_station.lat as dep_lat,
dep_station.lon as dep_lon,
extract(epoch from checkout_time) as checkout_ts,
extract(epoch from sched_arrival) as sched_arr_ts,
extract(epoch from real_arrival) as real_arr_ts,
checkout_station_id as arr_eva,
arr_station.ds100 as arr_ds100,
arr_station.name as arr_name,
arr_station.lat as arr_lat,
arr_station.lon as arr_lon,
polyline_id,
polylines.polyline as polyline,
visibility,
coalesce(visibility, users.public_level & 127) as effective_visibility,
cancelled, route, messages, user_data,
dep_platform, arr_platform, data
from in_transit
left join polylines on polylines.id = polyline_id
left join users on users.id = user_id
left join relations as r1 on r1.predicate = 1 and r1.object_id = user_id
left join stations as dep_station on checkin_station_id = dep_station.eva
left join stations as arr_station on checkout_station_id = arr_station.eva
;
update schema_version set version = 42;
}
);
},
);
# TODO add 'hafas' column to in_transit (and maybe journeys? undo/redo needs something to work with...)
...
...
This diff is collapsed.
Click to expand it.
lib/Travelynx/Model/InTransit.pm
+
32
−
0
View file @
d43c44e8
...
...
@@ -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
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment