• Resolved mwd123

    (@mwd123)


    I would like to create a custom contstant of say 1.01 to be able to get the stats sorting better when two players have same points (g+a), but one have made more goals. right now it sorts the one with more assists before the one with more goals.

    I think that if I add a custom hidden value to sort from, it should work. say:

    1.01xG + A

    I think this should solve my issue.

    How can I add constant 1.01 or similiar to the configurator?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter mwd123

    (@mwd123)

    Solved it by editing:

    class-sp-meta-box-equation.php

    added: $constants[101] = 101; (below the 100 one)

    and in configuration of sportspress:
    ( 101 × g ÷ 100 ) + a
    Call it something like p2 and check hide so it does not show
    put 2 in decimals.

    sort the widgets or whatever on p2, and its solved. ??

    • This reply was modified 6 years, 1 month ago by mwd123.
    Roch

    (@rochesterj)

    I’m glad it’s resolved!

    Please, let us know if you need anything else.

    Kind Regards,
    -Roch

    Plugin Contributor Savvas

    (@savvasha)

    Hi @mwd123,

    In general it is a very bad practice to edit core files of a plugin, because in every update you will need to maintain the changes.

    To achieve what you want you could easily do something like :
    P2 = (2 x g) + a or
    P2 = (100 + 1) ÷ 100 x g + a etc…

    Thanks,
    Savvas

    • This reply was modified 6 years, 1 month ago by Savvas.
    Thread Starter mwd123

    (@mwd123)

    Hi Savvas!

    The first line would only mess things up and make the one with more goals and less points in better position than a guy with more points buy only assists.

    But line 2 seems to work fine that was actually what I was looking for in the beginning, don’t have a clue why I didn’t see that I could do it that way first ??

    Thanks guys.

    /mwd

    • This reply was modified 6 years, 1 month ago by mwd123.
    Plugin Contributor Savvas

    (@savvasha)

    You are welcomed ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Create custom constant’ is closed to new replies.