• I created an equation in “Event Results” where an average is calculated from three different fields in “Player Performance”. For example: the first round the player finishes the race in a time of 18.5 seconds, the second round in 19.4 seconds, and the third round in 17.8 seconds.

    However, the equation does not work if I use decimals in the 3 rounds, it will only perform the calculation I specified in the equation if I use a number without decimal places in at least one of the rounds. Please fix this issue.

    Also, there are some sports where using minutes and seconds is not enough, like in running, where the difference could be of miliseconds. It would be nice if you added support for hh:mm:ss.fff.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Roch

    (@rochesterj)

    Hi!

    Thanks for reaching out and I’m sorry for the trouble.

    We have no reports of this kind of issue. Let me tag our dev team to check if there are any bug reports for this.

    @savvasha have you seen this issue before?

    As for adding a new field, please consider adding this to our ideaboard:
    http://tboy.co/ideas

    Thanks!

    Plugin Contributor Savvas

    (@savvasha)

    Hi @elbuenzurdo,

    Can you please share a screenshot of your Equation? I try to reproduce what you said and my results are correct. Look below:
    https://snag.gy/UrHaFm.jpg
    https://snag.gy/E7KtTn.jpg
    https://snag.gy/MfGdsh.jpg

    Thanks,
    Savvas

    Thread Starter elbuenzurdo

    (@elbuenzurdo)

    Hello @rochesterj and @savvasha,

    Thank you for your quick reply. Here are some screenshots of the issue, as you requested.

    https://federacionmexicanaderodeo.org/wp/wp-content/uploads/2018/08/Captura1.png
    https://federacionmexicanaderodeo.org/wp/wp-content/uploads/2018/08/Captura2.png
    https://federacionmexicanaderodeo.org/wp/wp-content/uploads/2018/08/Captura3.png

    In the screenshot, “tiempoprimeraronda”, “tiemposegundaronda”, “tiempoterceraronda” and “tiempocuartaronda” refer to Player Performance in “Number” format.

    The equation that is not working is in “Event Results”, where I made a formula to calculate the average of the fields where the user inputs something (for example, if one player completes all 4 rounds, the average is made for the 4 rounds, but if another player races in only 3 rounds, the average is made for 3 rounds).

    As you can see, after saving the Event, if all the competitors have decimal places in their times, the formula calculates nothing, but if at least one competitor has an integer in his time, the formula works for all of them.

    Plugin Contributor Savvas

    (@savvasha)

    Unfortunately I cannot reproduce what you describe. See below:
    https://snag.gy/sk1cgt.jpg (The equation the same way you say but with three rounds)
    https://snag.gy/uKa4MN.jpg (Trying with three and two rounds, all ok)
    https://snag.gy/ex1UMn.jpg (Trying with two and two rounds, all ok)

    Well, you can try to disable all plugins except SportsPress and switch to a default theme (like Rookie or Twenty Seventeen) and see if there is any difference.

    Thread Starter elbuenzurdo

    (@elbuenzurdo)

    @savvasha can you try by deleting all other “Player Performance” items? From what I see in your screenshots, the difference you have is additional fields “Behinds”/”Goals”/”Assists” which have a “0” (which is an integer).

    I added an additional field which is not part of the equation (I named it “dummy”) and gave it a value of 0, and the equation started working.

    I will try by disabling all plugins and will report back later.

    Plugin Contributor Savvas

    (@savvasha)

    Hi @elbuenzurdo,

    I trashed all Player Performances except FristRound, SecondRound and ThirdRound. Everything is working as it should be:
    https://snag.gy/a2giFZ.jpg

    Did you have any luck with disabling plugins and/or switching to a default theme?

    Thanks,
    Savvas

    Roch

    (@rochesterj)

    Hi!

    Thanks for the help @savvasha

    I’m not sure if this is the case but sometimes we have issues with the PHP version as well. Maybe it’s worth checking if you are running PHP7+. You can check this with your hosting provider.

    Thanks!

    Thread Starter elbuenzurdo

    (@elbuenzurdo)

    Hello guys,

    I disabled all plugins and switched my theme to Rookie, but it did not work, the only way to get all results calculated automatically is to have an integer in one of the “Player Performance” fields.

    Another thing that I just noticed is that if I have an Event which is already saved and with “Event Results” calculated, and then I update a value in one of the “Player Performance” fields, the “Event Results” are not updated, the only way to update them is to delete all fields from “Event Results” and save again.

    Is this normal behavior, or is my WordPress/Sportspress install going crazy?

    Plugin Contributor Savvas

    (@savvasha)

    Hi @elbuenzurdo,

    Unfortunately we cannot reproduce what you describe, so it is difficult to propose a solution. A workaround can be what you actually propose I added an additional field which is not part of the equation (I named it “dummy”) and gave it a value of 0, and the equation started working.

    In the Event Results, when a field is set to Auto Calculated based on equations, after the first save, the result is stored for performance reasons. You have to delete it and hit the Update button to recalculate.

    Thanks,
    Savvas

    Hi Team,
    I believe I may be running into the same/similar issue.
    I am running off of the basketball preset, but with some variations we play 2 pts for win 1.5 for draw 1 for loss.

    I have tried…

    
    (win x 2) + (loss x 1) + (foriet x 0) + (draw x 3 / 2)
    

    This results in no half point

    
    (win x 2) + (loss x 1) + (foriet x 0) + (draw / 2 + 1)
    

    This results in all team including those without any draws getting an extra point, as if the plus 1 is breaking out of the brackets.

    Oddly though, while testing for this post…

    
    (win x 2) + (loss x 1) + (foriet x 0) + (draw / 2 x 3)
    

    Does work!?!?

    Plugin Contributor Savvas

    (@savvasha)

    Hi @ian_gozer,

    Did you try something like:

    (win x 2) + loss + (draw x 3 )/2

    Thanks,
    Savvas

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Equation not working when using decimal places’ is closed to new replies.