[Dach-support] Not displaying accounts with negative reputation fix

mys(62)
Published in
#utopian-io
Words
73
Reading
1 min
Listen
Play
8y

image.png

This contribution is a solution to Not displaying accounts with reputation <25 via the "?info accountname" function!.
theaustrianguy@theaustrianguy bug report directs DACH-Discord server bot by jedigeiss@jedigeiss.

What was the issue(s)?

According to bughunter, ?info accountname command didn't display any info for users with reputation under 25. This is not exactly true, because the issue was with accounts of reputation < 0.

Examples:

  • ?info berniesanders (-17) - no response
  • ?info dzordyja (-1) - no response

Why is that?

Traversing through the code, it threw error at line:
rep = math.log10(rep)
where rep is raw reputation stored in blockchain. It is very large (or very small) number. According to steemd.com for berniesanders it is value of -46,967,291,106,564.
The math rule says common logarithm cannot calculate negative input numbers. That's why ValueError: math domain error happens exiting whole call.

Steem official formula

Steemit.com FAQ relates to nice article with formula explanation.

  • Take the log base 10 of the raw score
  • Subtract 9
  • Multiply by 9
  • Add 25
  • Round down to the nearest integer

image.png


Code snippet by digitalnotvir@digitalnotvir

What was the solution?

To keep things simple I have verified if raw reputation score is negative. Then calculated absolute value of it and logarithm of. Attached negative sign again to the result (if marked) and keep through rest of formula.

image.png


Formula for reputation level including negativeness

Links

https://github.com/jedigeiss/dach-support/pull/16



Posted on Utopian.io - Rewarding Open Source Contributors

[Dach-support] Not displaying accounts with negative reputation fix | Ecency