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
Commits
9f6e71a4
Commit
9f6e71a4
authored
4 years ago
by
Bartek Wrona
Browse files
Options
Downloads
Patches
Plain Diff
Merge branch 'bw_issue_134' into 'develop'
issue 134 See merge request
!476
(cherry picked from commit
31529ec2
)
9be3af99
Issue
#135
parent
02b28201
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!519
Merge branch 'bw_issue_134' into 'develop'
,
!478
Changes done in the MR 476 cherry-picked into master.
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hive/db/sql_scripts/calculate_account_reputations.sql
+26
-18
26 additions, 18 deletions
hive/db/sql_scripts/calculate_account_reputations.sql
with
26 additions
and
18 deletions
hive/db/sql_scripts/calculate_account_reputations.sql
+
26
−
18
View file @
9f6e71a4
...
@@ -110,6 +110,27 @@ $BODY$
...
@@ -110,6 +110,27 @@ $BODY$
DROP
FUNCTION
IF
EXISTS
calculate_account_reputations_for_block
;
DROP
FUNCTION
IF
EXISTS
calculate_account_reputations_for_block
;
DROP
TABLE
IF
EXISTS
__new_reputation_data
;
CREATE
UNLOGGED
TABLE
IF
NOT
EXISTS
__new_reputation_data
(
id
integer
,
author_id
integer
,
voter_id
integer
,
rshares
bigint
,
prev_rshares
bigint
);
DROP
TABLE
IF
EXISTS
__tmp_accounts
;
CREATE
UNLOGGED
TABLE
IF
NOT
EXISTS
__tmp_accounts
(
id
integer
,
reputation
bigint
,
is_implicit
boolean
,
changed
boolean
);
CREATE
OR
REPLACE
FUNCTION
calculate_account_reputations_for_block
(
_block_num
INT
,
_tracked_account
VARCHAR
DEFAULT
NULL
::
VARCHAR
)
CREATE
OR
REPLACE
FUNCTION
calculate_account_reputations_for_block
(
_block_num
INT
,
_tracked_account
VARCHAR
DEFAULT
NULL
::
VARCHAR
)
RETURNS
SETOF
accountreputation
RETURNS
SETOF
accountreputation
LANGUAGE
'plpgsql'
LANGUAGE
'plpgsql'
...
@@ -130,16 +151,9 @@ DECLARE
...
@@ -130,16 +151,9 @@ DECLARE
__traced_author
int
;
__traced_author
int
;
__account_name
varchar
;
__account_name
varchar
;
BEGIN
BEGIN
CREATE
UNLOGGED
TABLE
IF
NOT
EXISTS
__new_reputation_data
(
DELETE
FROM
__new_reputation_data
;
id
integer
,
author_id
integer
,
voter_id
integer
,
rshares
bigint
,
prev_rshares
bigint
);
TRUNCATE
TABLE
__new_reputation_data
;
INSERT
INTO
__new_reputation_data
INSERT
INTO
__new_reputation_data
SELECT
rd
.
id
,
rd
.
author_id
,
rd
.
voter_id
,
rd
.
rshares
,
SELECT
rd
.
id
,
rd
.
author_id
,
rd
.
voter_id
,
rd
.
rshares
,
COALESCE
((
SELECT
prd
.
rshares
COALESCE
((
SELECT
prd
.
rshares
...
@@ -152,15 +166,9 @@ BEGIN
...
@@ -152,15 +166,9 @@ BEGIN
ORDER
BY
rd
.
id
ORDER
BY
rd
.
id
;
;
CREATE
UNLOGGED
TABLE
IF
NOT
EXISTS
__tmp_accounts
(
id
integer
,
reputation
bigint
,
is_implicit
boolean
,
changed
boolean
);
TRUNCATE
TABLE
__tmp_accounts
;
DELETE
FROM
__tmp_accounts
;
INSERT
INTO
__tmp_accounts
INSERT
INTO
__tmp_accounts
SELECT
ha
.
id
,
ha
.
reputation
,
ha
.
is_implicit
,
false
AS
changed
SELECT
ha
.
id
,
ha
.
reputation
,
ha
.
is_implicit
,
false
AS
changed
FROM
__new_reputation_data
rd
FROM
__new_reputation_data
rd
...
...
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