[Utopian.io] Utopians are no longer a Plankton, profile page bugfix

in #utopian-io7 years ago (edited)

image.png

If You go to Utopian.io user's profile page like that https://utopian.io/@mys You can see account's base info eg. name, reputation, voting power, projects etc. There is calculated "rank name" also. The assigned rank is based on how many Vests does one have accumulated.

image.png

Profile page. Plankton?

Issue

Traversing through profiles it seems that everyone has rank "Plankton". No matter how many Vests do they have. That becomes pretty strange because code logic behind that is pretty straight. So what makes it different then?

image.png

Transition of Vests amount into rank name

Solution

It took me some time to go through the source code to find the issue. I had to traverse past profile page template, and leap through calls that transform user info into ranks. In the end the getUserRank method always returned to me "Plankton". While debugging have I found something pretty obvious, even when the code logic was clean.

image.png

'vests' variable is a string with unit not a number

This is why it never jumped into any of 'if' condition. String is not comparable to a number.
All I had to do was parse number from 'vests' in proper way.

image.png

Results:

image.png

image.png

image.png

image.png

Everyone have adjacent rank now.

3 words

For somebody from outside, it can look I have modified just 1-2 lines of code. My contribution may seem like that amount of work was not too much. The clue is that it is fix of a bug. This should be understood that bugfixing work is in 95% finding the issue, then the rest is the coding part. Finding bugs like incompatible types in assignment are easy signalized while writing, but pretty hard to find while running in production. No single warning or error makes it even harder job.
Maybe this is the reason why nobody could solve it for 2 months? Maybe the Steem API has changed in the meantime or the feature wasn't tested enough. Does not matter now.

Links

https://github.com/utopian-io/utopian.io/pull/267



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

can you say me what is the vest?
I don't know, that is the vest.

In short story, Vests are Your shares in Steem Power economy. This is Your voting power between all the Steemians. They are connected to Steem Power but the formula is not clear enough for me :/

You can read more here https://steemit.com/steem-help/@hisnameisolllie/what-are-vests
Steemd shows Your exact amount https://steemd.com/@jillfeint

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Hey @mys I am @utopian-io. I have just upvoted you!

Achievements

  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

Coin Marketplace

STEEM 0.19
TRX 0.15
JST 0.029
BTC 63178.17
ETH 2581.50
USDT 1.00
SBD 2.71