#### Expected behavior The utopian-moderator extension should show the current utopian-io voting power #### Actual behavior  The extension shows the utopian-io voting power at the time of the last utopian vote. The `voting_power` field in the steem account information only stores the VP at the time of the last vote, not the current value: ```python >>> from steem.account import Account >>> a = Account("utopian-io") >>> a['voting_power'] 6680 ``` In order to get the current VP, one has to calculate the voting power regeneration since the last vote. Here's the python-equivalent to get the current voting power: ``` def get_voting_power(account): """get current voting power. The 'last_vote_time' value in the account data only contains the VP at the time of the last vote. """ last_vote_time = parse(account['last_vote_time']) diff = (dt.datetime.utcnow() - last_vote_time).total_seconds() regenerated_vp = diff * 10000 / 86400 / 5 total_vp = (account['voting_power'] + regenerated_vp) / 100.0 if total_vp > 100: total_vp = 100.0 return total_vp ``` #### How to reproduce Compare the value in the extension with those on steemd/steemworld/... Here is the corresponding part in the code: https://github.com/DoctorLai/utopian-moderator/blob/2c9d77f73b344191cf850d28a419413961cc8fd1/js/utopian.js#L391 @justyy, steemtools seems to be affected as well: https://github.com/DoctorLai/SteemTools/blob/24283592c488f23b0df4218982ecb801343d2496/js/steemtools.js#L36 <br /><hr/><em>Posted on <a href="https://utopian.io/utopian-io/@stmdev/vp-calculation-is-wrong">Utopian.io - Rewarding Open Source Contributors</a></em><hr/>
author | stmdev | ||||||
---|---|---|---|---|---|---|---|
permlink | vp-calculation-is-wrong | ||||||
category | utopian-io | ||||||
json_metadata | "{"community":"utopian","app":"utopian/1.0.0","format":"markdown","repository":{"id":119434075,"name":"utopian-moderator","full_name":"DoctorLai/utopian-moderator","html_url":"https://github.com/DoctorLai/utopian-moderator","fork":false,"owner":{"login":"DoctorLai"}},"pullRequests":[],"platform":"github","type":"bug-hunting","tags":["utopian-io","moderator","extension","bug","votingpower"],"users":["justyy","stmdev"],"links":["https://res.cloudinary.com/hpiynhbhq/image/upload/v1518783521/ze9xsp0vrhogxowgvzkz.png"],"image":["https://res.cloudinary.com/hpiynhbhq/image/upload/v1518783521/ze9xsp0vrhogxowgvzkz.png"],"moderator":{"account":"justyy","time":"2018-02-17T21:42:29.595Z","reviewed":true,"pending":false,"flagged":false},"questions":[],"score":0,"issue":{"url":"https://github.com/DoctorLai/utopian-moderator/issues/2","number":2,"id":298038935,"title":"Shown Voting Power is not the current value"}}" | ||||||
created | 2018-02-16 12:23:33 | ||||||
last_update | 2018-02-17 21:42:33 | ||||||
depth | 0 | ||||||
children | 2 | ||||||
last_payout | 2018-02-23 12:23:33 | ||||||
cashout_time | 1969-12-31 23:59:59 | ||||||
total_payout_value | 7.624 HBD | ||||||
curator_payout_value | 3.372 HBD | ||||||
pending_payout_value | 0.000 HBD | ||||||
promoted | 0.000 HBD | ||||||
body_length | 1,782 | ||||||
author_reputation | 10,427,398,400,460 | ||||||
root_title | "Shown Voting Power is not the current value" | ||||||
beneficiaries |
| ||||||
max_accepted_payout | 1,000,000.000 HBD | ||||||
percent_hbd | 10,000 | ||||||
post_id | 37,992,678 | ||||||
net_rshares | 2,240,251,694,026 | ||||||
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
cifer | 0 | 2,692,977,584 | 80% | ||
crokkon | 0 | 27,493,126,713 | 100% | ||
arifinusman | 0 | 444,412,800 | 100% | ||
utopian-io | 0 | 2,208,561,473,037 | 1.29% | ||
kennethz | 0 | 846,835,968 | 100% | ||
irfanafridi | 0 | 212,867,924 | 40% |
Thank you for the contribution. It has been approved. Thanks! good catch.. You can submit the PR to fix or wait till my next version. :) You can contact us on [Discord](https://discord.gg/uTyJkNm). **[[utopian-moderator]](https://utopian.io/moderators)**
author | justyy |
---|---|
permlink | re-stmdev-vp-calculation-is-wrong-20180217t214315558z |
category | utopian-io |
json_metadata | {"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"} |
created | 2018-02-17 21:43:15 |
last_update | 2018-02-17 21:43:15 |
depth | 1 |
children | 0 |
last_payout | 2018-02-24 21:43:15 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.122 HBD |
curator_payout_value | 0.037 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 257 |
author_reputation | 280,616,224,641,976 |
root_title | "Shown Voting Power is not the current value" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 38,357,022 |
net_rshares | 28,170,983,148 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
crokkon | 0 | 28,170,983,148 | 100% |
### Hey @stmdev I am @utopian-io. I have just upvoted you! #### Achievements - You have less than 500 followers. Just gave you a gift to help you succeed! - Seems like you contribute quite often. AMAZING! #### Suggestions - Contribute more often to get higher and higher rewards. I wish to see you often! - Work on your followers to increase the votes/rewards. I follow what humans do and my vote is mainly based on that. Good luck! #### Get Noticed! - Did you know project owners can manually vote with their own voting power or by voting power delegated to their projects? Ask the project owner to review your contributions! #### Community-Driven Witness! I am the first and only Steem Community-Driven Witness. <a href="https://discord.gg/zTrEMqB">Participate on Discord</a>. Lets GROW TOGETHER! - <a href="https://v2.steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1">Vote for my Witness With SteemConnect</a> - <a href="https://v2.steemconnect.com/sign/account-witness-proxy?proxy=utopian-io&approve=1">Proxy vote to Utopian Witness with SteemConnect</a> - Or vote/proxy on <a href="https://steemit.com/~witnesses">Steemit Witnesses</a> [](https://steemit.com/~witnesses) **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**
author | utopian-io |
---|---|
permlink | re-stmdev-vp-calculation-is-wrong-20180218t150106545z |
category | utopian-io |
json_metadata | {"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"} |
created | 2018-02-18 15:01:06 |
last_update | 2018-02-18 15:01:06 |
depth | 1 |
children | 0 |
last_payout | 2018-02-25 15:01:06 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 1,504 |
author_reputation | 152,955,367,999,756 |
root_title | "Shown Voting Power is not the current value" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 38,536,384 |
net_rshares | 0 |