I am currently attempting to complete an update on the @pibarabot daily flag-war reports. You can measure the weight of a flag in several ways:
- The impact on projected pay-out as counted in RSHARES
- The impact on reputation as counted in RSHARES
- The impact on reputation as counted in reputation points
Basically, I have the first one working OK, and the second one seems ready to use also, only, I would rather use the third one over the second one (together with the first. Today I ran the first test with something that should have done the third, but for some reason, there are some major anomalies.
I'll list a walkthrough.
My script walks through one day of blocks. I start the script every day through cron, and the script processes one single day, seven days in the past. The day that has just closed for downvotes. For this day, I look at all top-level posts (that is, blog posts, not comments) and I fetch the post with its meta data.
Posts of this age still have a lot of useful metadata, including author_reputation and active_votes, the information I was hoping to use for my purpose.
Each vote listed in active_votes has a number of fields, including a timestamp (so I can process them sorted by date) and the reputation of the person casting the vote.
So what do I do to try and calculate the reputation damage done by votes on a post:
def process_content(content,c2):
rshares = 0.0
reprshares = int(content["author_reputation"])
def flagng(voter,reputaton_rshares, vote_rshares):
def as_rep(rawrep):
if rawrep == 0:
return 25.0
if rawrep > 0:
rval = (math.log10(rawrep) - 9)*9+25
if rval < 25.0:
rval = 25.0
return rval
else:
return 25 - (math.log10(0 - rawrep) - 9)*9
repdamage = as_rep(reputaton_rshares) - as_rep(reputaton_rshares + vote_rshares)
print(voter,comment_event["author"],as_rep(reputaton_rshares),as_rep(reputaton_rshares + vote_rshares), "=>", repdamage);
self.count.flagng(voter,comment_event["author"],repdamage)
def flag(voter,vote_rshares):
self.count.flag(voter,comment_event["author"],vote_rshares)
def downvote(voter,vote_rshares):
self.count.downvote(voter,comment_event["author"],vote_rshares)
def flag_or_downvote(voter,vote_rshares,voter_rep):
if rshares > 0.0:
if (vote_rshares > rshares):
downvote(voter,rshares)
else:
downvote(voter,vote_rshares)
if reprshares < voter_rep:
flag(voter, vote_rshares)
flagng(voter,reprshares,vote_rshares)
if len(content["active_votes"]) > 0:
sortedvotes = sorted(content["active_votes"], key=lambda kv: kv["time"])
for vote in sortedvotes:
if isinstance(vote["rshares"], basestring):
vote["rshares"] = float(vote["rshares"])
if vote["rshares"] < 0.0:
flag_or_downvote(vote["voter"],vote["rshares"],vote["reputation"])
rshares += vote["rshares"]
reprshares += vote["rshares"]
And everything seemed to be working, but then I looked at some of the actual data for the total link reputation damage:
- @spaminator -> @ansie : 230.9
- @spaminator -> @tanisa : 169.5
- @ipromote -> @liberacesghost : 160.4
- @steemcleaners -> @kofpato : 157.3
- @steemcleaners -> @dwayne16 : 135.2
- @spaminator -> @mamon51 : 122.9
- @steemcleaners -> @akbarsanjani : 114.7
- @steemcleaners -> @karepo : 110.9
- @stellabelle -> @rabiagilani : 107.6
- @church-of-piglet -> @subrata9744 : 104.0
Something is definitely terribly wrong here. These accounts might hold quite some punching power, but dealing 230 reputation points of damage to a single account in a single day is simply nonsense. Been looking at my code for over two hours but it just doesn't register. Something is really very wrong about this code, but what is it?
Did I write a silly bug, or am I simply not using the post metadata as it is supposed to be interpreted?
If you are reading this and think you understand what I might be doing horribly wrong, please comment below. I really think adding a by reputation impact visualization to the @pibarabot script would be usefull, but I could really use an other pair of eyes at this point in time.