While playing around with the new version of the Utopian bot, I noticed that the 'task-requests' where not upvoted, and couldn't seem to find why.
One of the posts I found to be non-upvoted in this category was actually pointing to a permlink that didn't exist but the others should have worked. After digging a bit, I realized what was going on:
- Because the bot couldn't find that wrong permlink, it thought that this post had no upvote
- At some point, the nb of upvotes is used in a division, and well. if you remember your maths lesson, dividing by zero is not a thing you want to do :
- Dividing by zero cause a NaN result to the calculate (Not a Number) and therefore the post wilth the wrong permlink couldn't be upvoted. The one with the right permlink was already upvoted so
fixed this in the database.
Now, to understand what was going on with the other contributions and prevent this I had to dig a little bit more and realize that:
- When calculating the votes pool for each categories, the votes are added to each other.
- Only one NaN is sufficient to ruin it all and cause the reward pool for the category to become NaN.
Therefore, I made sure in this commit that if we get a null number of votes for a reason or another, we'll set it to one instead.
It will prevent this situation from happening again.
Posted on Utopian.io - Rewarding Open Source Contributors