You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
AvalonMonoScripts/downvoteEarnedVsUpvotepEarn...

74 lines
2.0 KiB

mongo = require("./mongoHelp.js")
approx = require("approximate-number")
userlist = ['nannal',"shitpostbapper",'clean-mink-255','drab-wasp-918','russel-similar-955','monkey-extra-small-439','burmese-metallic-102','toad-wealthy-859','gorilla-uncommon-408','bandicoot-pesky-709','woodpecker-harmless-984','gorilla-idle-769','gibbon-harmless-779','moth-trained-424','dane-barren-384','born2peeforced2aim','b4963559-4b5c-4a33-a604-ef72fc3f11a7','03934fdc-e41a-47a9-9a31-6caf645247c2','1d49e3e7-2160-46e7-a1a6-dc97cba60cce','02807c99-04c8-4318-8dd7-5946cec71860','87b8ac3a-9cac-4a2e-a06d-86b30138b510','133ca83c-0d1f-41d9-a3e2-18a42be998b4','e6b3ccd2-f4dd-425f-9d40-3824c08804db','e009da63-68a3-4c97-a655-d5152fdb7e84','d1df4b0f-0872-4ec5-a3c4-721391d6214d']
orArr = []
userlist.forEach(element => {
orArr.push({'votes.u': element})
})
dAgg = [
{
'$unwind': {
'path': '$votes',
'includeArrayIndex': 'string',
'preserveNullAndEmptyArrays': false
}
}, {
'$match': {
$or: orArr
}
}, {
'$match': {
'votes.vt': {
'$lt': 0
}
},
},
]
uAgg = [
{
'$unwind': {
'path': '$votes',
'includeArrayIndex': 'string',
'preserveNullAndEmptyArrays': false
}
}, {
'$match': {
$or: orArr
}
}, {
'$match': {
'votes.vt': {
'$gt': 0
}
},
},
]
dClaimed = 0
dVt = 0
mongo.aggregate('avalon5', 'contents', dAgg).then(res => {
res.forEach(element => {
dClaimed = dClaimed+element.votes.claimable
dVt = dVt+(element.votes.vt*-1)
})
console.log("Down, ",dVt,dClaimed/100,(dClaimed/100)/dVt)
console.log("Down aprox, ",approx(dVt),approx(dClaimed/100))
})
uClaimed = 0
uVt = 0
mongo.aggregate('avalon5', 'contents', uAgg).then(res => {
res.forEach(element => {
uClaimed = uClaimed+element.votes.claimable
uVt = uVt+(element.votes.vt)
})
console.log("Up, ",uVt,uClaimed/100,(uClaimed/100)/uVt)
console.log("Up aprox, ",approx(uVt),approx(uClaimed/100))
})