You are viewing a single comment's thread from:

RE: HiveStats: Developer's Insight

in LeoFinance2 years ago

i've succeeded using list_votes for a user, then get_content on each of those posts that is less than 7 days old (voting time) .. then check that cashout_time > currentTime .. if so I run the calc for curation rewards.

to avoid running the whole list_votes, I am retaining the closest link .. right now hardcoded in. that saves a ton of time.

query all the posts is slow, wouldn't want to run it very often.

the estimations appears close to my 7 day average.

this whole project has been a major success, thank you for helping me get a grasp on working with the hive api!

you saved me a ton of time.

i found this that is sort of an error (I could check that cash-out is zero and not send it here)

but ended up dividing by zero in the vote_reward

so I added

if { $total_vote_weight == 0 } {
    # If we don't this, divide by zero error on no-cashout.
    set ratio 0
} else {
    set ratio [expr { $curation_reward * 1000 * $weight / $total_vote_weight }]
}

an fyi.

thank you!

namaste

Posted Using LeoFinance Beta

Sort:  

Happy to hear that, you are welcome!

but ended up dividing by zero in the vote_reward

I probably wrote something wrong, idk, but thanks for pointing out.