Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hivemind
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
hive
hivemind
Merge requests
!145
A 'get_profile' implementation
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
A 'get_profile' implementation
mt-get-profile-impl
into
latest_deployed_develop
Overview
0
Commits
7
Pipelines
0
Changes
3
Merged
Mariusz Trela
requested to merge
mt-get-profile-impl
into
latest_deployed_develop
4 years ago
Overview
0
Commits
7
Pipelines
0
Changes
3
Expand
@bwrona
0
0
Merge request reports
Viewing commit
638f932b
Prev
Next
Show latest version
3 files
+
36
−
44
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
638f932b
Final version of `hive_accounts_info_view` view
· 638f932b
Mariusz Trela
authored
4 years ago
hive/db/schema.py
+
31
−
38
Options
@@ -576,10 +576,37 @@ def setup(db):
SELECT
id,
name,
COALESCE(
(
select count(*) post_count
FROM hive_posts hp
WHERE ha.id=hp.author_id
GROUP BY hp.author_id
),
0
) post_count,
COALESCE(
(
select max(hp.created_at)
FROM hive_posts hp
WHERE ha.id=hp.author_id
GROUP BY hp.author_id
),
'
1970-01-01 00:00:00.0
'
) post_active_at,
COALESCE(
(
select max(hv.last_update)
from hive_votes hv
WHERE ha.id=hv.voter_id
GROUP BY hv.voter_id
),
'
1970-01-01 00:00:00.0
'
) AS vote_active_at,
created_at,
display_name,
about,
reputation,
created_at,
profile_image,
location,
website,
@@ -587,47 +614,13 @@ def setup(db):
rank,
following,
followers,
(
CASE
WHEN COALESCE( post_info.post_active_at,
'
1970-01-01 00:00:00.0
'
) > COALESCE( vote_info.vote_active_at,
'
1970-01-01 00:00:00.0
'
) THEN
(
CASE
WHEN COALESCE( post_info.post_active_at,
'
1970-01-01 00:00:00.0
'
) > created_at THEN
COALESCE( post_info.post_active_at,
'
1970-01-01 00:00:00.0
'
)
ELSE
created_at
END
)
ELSE
(
CASE
WHEN COALESCE( vote_info.vote_active_at,
'
1970-01-01 00:00:00.0
'
) > created_at THEN
COALESCE( vote_info.vote_active_at,
'
1970-01-01 00:00:00.0
'
)
ELSE
created_at
END
)
END
) active_at,
proxy,
proxy_weight,
lastread_at,
cached_at,
raw_json,
COALESCE( post_info.post_count, 0 ) post_count
from hive_accounts ha
LEFT JOIN
(
select count(*) post_count, max(created_at) post_active_at, author_id
from hive_posts
GROUP BY author_id
) post_info ON ha.id=post_info.author_id
LEFT JOIN
(
select max(last_update) vote_active_at, voter_id
from hive_votes
GROUP BY voter_id
)vote_info ON ha.id=vote_info.voter_id
raw_json
FROM
hive_accounts ha
"""
db
.
query_no_return
(
sql
)
Loading