all rewards go to zappers
This commit is contained in:
parent
37e70f9791
commit
490ed59099
|
@ -1,10 +1,9 @@
|
||||||
const serialize = require('../api/resolvers/serial')
|
const serialize = require('../api/resolvers/serial')
|
||||||
|
|
||||||
const ITEM_EACH_REWARD = 3.0
|
// const ITEM_EACH_REWARD = 3.0
|
||||||
const UPVOTE_EACH_REWARD = 6.0
|
// const UPVOTE_EACH_REWARD = 6.0
|
||||||
const TOP_PERCENTILE = 21
|
const TOP_PERCENTILE = 21
|
||||||
|
|
||||||
// TODO: use a weekly trust measure or make trust decay
|
|
||||||
function earn ({ models }) {
|
function earn ({ models }) {
|
||||||
return async function ({ name }) {
|
return async function ({ name }) {
|
||||||
console.log('running', name)
|
console.log('running', name)
|
||||||
|
@ -25,7 +24,7 @@ function earn ({ models }) {
|
||||||
sum += donatedSum * 1000
|
sum += donatedSum * 1000
|
||||||
|
|
||||||
/*
|
/*
|
||||||
How earnings work:
|
How earnings (used to) work:
|
||||||
1/3: top 21% posts over last 36 hours, scored on a relative basis
|
1/3: top 21% posts over last 36 hours, scored on a relative basis
|
||||||
1/3: top 21% comments over last 36 hours, scored on a relative basis
|
1/3: top 21% comments over last 36 hours, scored on a relative basis
|
||||||
1/3: top upvoters of top posts/comments, scored on:
|
1/3: top upvoters of top posts/comments, scored on:
|
||||||
|
@ -33,6 +32,8 @@ function earn ({ models }) {
|
||||||
- how much they tipped
|
- how much they tipped
|
||||||
- how early they upvoted it
|
- how early they upvoted it
|
||||||
- how the post/comment scored
|
- how the post/comment scored
|
||||||
|
|
||||||
|
Now: 100% of earnings go to zappers of the top 21% of posts/comments
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (sum <= 0) {
|
if (sum <= 0) {
|
||||||
|
@ -78,12 +79,9 @@ function earn ({ models }) {
|
||||||
GROUP BY "userId", "parentId" IS NULL
|
GROUP BY "userId", "parentId" IS NULL
|
||||||
)
|
)
|
||||||
SELECT "userId", NULL as id, type, ROW_NUMBER() OVER (PARTITION BY "isPost" ORDER BY upvoter_ratio DESC) as rank,
|
SELECT "userId", NULL as id, type, ROW_NUMBER() OVER (PARTITION BY "isPost" ORDER BY upvoter_ratio DESC) as rank,
|
||||||
upvoter_ratio/(sum(upvoter_ratio) OVER (PARTITION BY "isPost"))/${UPVOTE_EACH_REWARD} as proportion
|
upvoter_ratio/(sum(upvoter_ratio) OVER (PARTITION BY "isPost")) as proportion
|
||||||
FROM upvoter_ratios
|
FROM upvoter_ratios
|
||||||
WHERE upvoter_ratio > 0
|
WHERE upvoter_ratio > 0`)
|
||||||
UNION ALL
|
|
||||||
SELECT "userId", id, type, rank, ratio/${ITEM_EACH_REWARD} as proportion
|
|
||||||
FROM item_ratios`)
|
|
||||||
|
|
||||||
// in order to group earnings for users we use the same createdAt time for
|
// in order to group earnings for users we use the same createdAt time for
|
||||||
// all earnings
|
// all earnings
|
||||||
|
|
Loading…
Reference in New Issue