Skip to content
GitLab
Explore
Sign in
Register
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
!863
Draft: refactor follows and update_nofications indexing
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Draft: refactor follows and update_nofications indexing
267-update-notification-cache
into
develop
Overview
0
Commits
83
Pipelines
0
Changes
666
Open
Dan Notestein
requested to merge
267-update-notification-cache
into
develop
1 week ago
Overview
0
Commits
83
Pipelines
0
Changes
4
Expand
Based on
!819
Edited
1 week ago
by
Krzysztof Leśniak
0
0
Merge request reports
Compare
version 1
version 7
b6e98c4f
21 hours ago
version 6
e23b6b20
2 days ago
version 5
b324dc58
4 days ago
version 4
08bda96a
5 days ago
version 3
06934459
1 week ago
version 2
1e627fa0
1 week ago
version 1
79277ddd
1 week ago
develop (HEAD)
and
version 2
latest version
e26892d5
83 commits,
15 hours ago
version 7
b6e98c4f
83 commits,
21 hours ago
version 6
e23b6b20
81 commits,
2 days ago
version 5
b324dc58
80 commits,
4 days ago
version 4
08bda96a
79 commits,
5 days ago
version 3
06934459
78 commits,
1 week ago
version 2
1e627fa0
76 commits,
1 week ago
version 1
79277ddd
74 commits,
1 week ago
Show latest version
4 files
+
131
−
43
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
4
Search (e.g. *.vue) (Ctrl+P)
hive/db/sql_scripts/notifications_view.sql
+
0
−
35
Options
@@ -96,19 +96,6 @@ CREATE OR REPLACE VIEW hivemind_app.hive_raw_notifications_as_view
notifs
.
payload
,
harv
.
score
FROM
(
SELECT
hr
.
block_num
,
hp
.
id
AS
post_id
,
14
AS
type_id
,
hr
.
created_at
,
hr
.
blogger_id
AS
src
,
hp
.
author_id
AS
dst
,
hr
.
post_id
as
dst_post_id
,
''
::
character
varying
(
16
)
AS
community
,
''
::
character
varying
AS
community_title
,
''
::
character
varying
AS
payload
FROM
hivemind_app
.
hive_reblogs
hr
-- reblogs
JOIN
hivemind_app
.
hive_posts
hp
ON
hr
.
post_id
=
hp
.
id
UNION
ALL
SELECT
hs
.
block_num
,
0
AS
post_id
,
11
AS
type_id
,
@@ -230,25 +217,3 @@ FROM
SELECT
*
FROM
hivemind_app
.
hive_raw_notifications_view_no_account_score
)
as
notifs
WHERE
notifs
.
score
>=
0
AND
notifs
.
src
IS
DISTINCT
FROM
notifs
.
dst
;
DROP
VIEW
IF
EXISTS
hivemind_app
.
notifications_scores
CASCADE
;
CREATE
OR
REPLACE
VIEW
hivemind_app
.
notifications_scores
AS
-- With clause is inlined, modified call to reptracker_endpoints.get_account_reputation.
-- Reputation is multiplied by 7.5 rather than 9 to bring the max value to 100 rather than 115.
-- In case of reputation being 0, the score is set to 25 rather than 0.
WITH
log_account_rep
AS
(
SELECT
account_id
,
LOG
(
10
,
ABS
(
nullif
(
reputation
,
0
)))
AS
rep
,
(
CASE
WHEN
reputation
<
0
THEN
-
1
ELSE
1
END
)
AS
is_neg
FROM
reptracker_app
.
account_reputations
),
calculate_rep
AS
(
SELECT
account_id
,
GREATEST
(
lar
.
rep
-
9
,
0
)
*
lar
.
is_neg
AS
rep
FROM
log_account_rep
lar
)
SELECT
account_id
,
COALESCE
((
cr
.
rep
*
7
.
5
+
25
)::
INT
,
25
)
AS
score
FROM
calculate_rep
AS
cr
Loading