My Steemit Friends Update: Fixed NaN error in contribution calculator, added Following & Reputation information to Follower Ranking

in utopian-io •  7 years ago  (edited)

Tool website: http://mysteemitfriends.online
Github: https://github.com/Bulletproofmonk/MySteemitFriends
Merged Pull Request: https://github.com/Bulletproofmonk/MySteemitFriends/pull/5

New Features

  • What feature(s) did you add?

I added the following and reputation columns to the followers ranking table, so you will be able to see more information about a user. Please test the feature at http://mysteemitfriends.online/followers.php

image.png

All the previous functions (search for particular user, page browsing) have been tested to work fine after this update.

I also added a link to do a reverse lookup on the contribution calculator, so that if you are viewing the page to see how much you have contributed to a particular user, you can click the link just below the calculator to see how much that user has contributed to you. To test this feature please follow the instructions below:

Enter your name into the main page:

Click on the number of upvotes to get to the next screen:
image.png

Click the link that says "Reverse Lookup" and you will be able to see how much that user has contributed to you:

3.jpg

4.JPG

  • How did you implement it/them?

I changed the SQL of the code to obtain the ranking table between lines 237 to 268 in followers.php. Before this update, the SQL only contained 6 lines but now it contains 30 lines, using the WITH statement to create temporary result sets for each of the columns which are joined together into one result. The result is then extracted by PHP to print to the page between lines 325 and 333, as well as some code to fix the alignment of numbers and decimal formatting.

As for the reverse lookup, it was done with PHP as shown at upvotelist.php on line 68, where I simply reloaded the page with variables for voter and author reversed. This is a simple-to-implement but useful feature.

Bug Fixes

  • What was the issue(s)?

When I was testing the program, I found that if I choose "all" for number of months on the first page to look at the number of articles voted on since the start of Steemit, and then use the contribution calculator to find out how much money I have contributed to a user from the beginning, I will get this error:

1.JPG

I thought it was because there were too many articles. However, that was not the issue. The issue was simply that there was an article where the number of total rshares allocated to the article was 0. So the $ calculation broke down because it is impossible to divide by 0. See screenshot below:

2.JPG

Provide links to related issues on GitHub, that you fixed, if applicable.

  • What was the solution?

I added an if statement to upvotelist.php between line 223 to 225, so that the NaN is converted to 0, before being added to the calculator. This fixed the issue.



Posted on Utopian.io - Rewarding Open Source Contributors

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Very cool update!

Thank you @teamsteem!!!

Hey @magicmonk 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

Thank you very much utopian!

Thank you for the contribution. It has been approved.

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

thank you so much

cool stuff you are doing!

thank you :) same to you :)

Informative post specially for newbies just like me who don't know much about steemit :)

Great work @magicmonk :)

nice work, it has great potential!

it is so good post. like your post