VidYen / VidYen-WordPress-Plugins

VidYen Plugins for WordPress
GNU General Public License v2.0
9 stars 2 forks source link

Issue Mining #98

Closed mcdeimon closed 5 years ago

mcdeimon commented 5 years ago

Hi. I have put Hash = 10000 but when the hashes reach 5000 it appears 1 added point. The point would not appear until you reach 10000 hashes. If you press the redeem button the point is not added but it should not be seen. It can create confusion in the users.

VidYen commented 5 years ago

Hi, I noticed this too. I will investigate.

VidYen commented 5 years ago

After looking at it, I have an idea why. I believe its the rounding issue with the amount of points. I can solve through a > or +1 I think.

VidYen commented 5 years ago

For a place holder for me as I think this will fix it...

                  if(totalhashes > 0){
                      document.getElementById('total_hashes').innerText = ' ' + totalhashes;

                      if(totalhashes > $hash_per_point ){
                        totalpoints = Math.round( totalhashes / $hash_per_point );
                        document.getElementById('total_points').innerText = totalpoints;
                      }
mcdeimon commented 5 years ago

Great!!!

VidYen commented 5 years ago

Oh yeah. I haven't put the fix out yet :) So leave it open for now.

VidYen commented 5 years ago

Just for reference... I needed to use a floor instead of round as js was seeing .5 as the threshold:

totalpoints = Math.floor( totalhashes / $hash_per_point );

Has given me an idea to add a progress bar in there....

VidYen commented 5 years ago

Ok. I'm 99.999% sure I fixed this with the floor method. I am going to work on a progress bar for better visuals so the user knows how close they are to a point tick.

But I am going to close this now as resolved bug.