Support » Plugin: SportsPress - Sports Club & League Manager » Problem with using bracket operator in player statistic

  • Resolved lukodp

    (@lukodp)


    Hello,

    I’m having specific problem with using bracket operator in configuring players statistic.
    I’ll try to explain the situation:
    a) I have these variables in player performance:
    1. unjevig
    2. unjevid
    3. nastupdoma
    4. nastupgost
    b) I want to create something like this:
    (unjevig+(unjevid/nastupdoma))/nastupgost+1

    I’ll try to explain further;
    unjevig = summary of knocked pins on away games
    unjevid = summary of knocked pins on home games
    nastupdoma = number of appearances home
    nastupgost = number of appearances away

    I need statistic that have: summery of away game pins + avarage of home pins all divided by appearances away + 1

    This is the error I’m getting with every version of formula with bracket: http://luko-delponte.from.hr/test/list/igrac-lige-2-hkls20142015/

    This is complicated I know, but it’s the only thing I can’t do with this plugin and it’s essential for competition 🙂

    I will appreciate any kind of help!

    BW
    Luko

    https://wordpress.org/plugins/sportspress/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Brian

    (@brianmiyaji)

    Hi Luko,

    From the error it looks like there might be mismatched parentheses, which means that there are not an equal number of “(” and “)”. I’d be happy to assist you further if you could paste in the output of SportsPress > Settings > System Status below, using the “code” button.

    lukodp

    (@lukodp)

    `
    ### Environment ###

    Početni URL: http://luko-delponte.from.hr/test
    URL stranice: http://luko-delponte.from.hr/test
    SP verzija: 1.5
    WP verzija: 4.1
    WP Multisite uključen: Ne
    Web Server Info: Apache
    PHP verzija: 5.3.29
    WP limit memorije: 40 MB – We recommend setting memory to at least 64MB. See: Increasing memory allocated to PHP
    WP Debug Mod: Ne
    WP jezik: Zadano
    WP Max Upload Size: 512 MB
    PHP Post Max Size: 512 MB
    PHP Time Limit: 30
    PHP Max Input Vars: 1000
    SUHOSIN instaliran: Ne
    Default Timezone: Default timezone is UTC
    fsockopen/cURL: Your server has fsockopen and cURL enabled.
    SOAP Client: Your server does not have the SOAP Client class enabled – some gateway plugins which use SOAP may not work as expected.

    ### Dodaci ###

    Instalirani dodaci: SportsPress od ThemeBoy verzija 1.5
    WordPress uvoznik od wordpressdotorg verzija 0.6.1

    ### SP konfiguracija ###

    Sport: custom
    Event Outcomes: Pobjeda (pobjeda) [0]
    Poraz (poraz) [0]
    Neriješeno (nerijeeno) [0]

    Team Results: Bod (bod) [0]
    Poena (poena) [0]
    Ukupno čunjeva (ucunjeva) [0]
    Setova (setova) [2]

    Player Performance: Poen (poen) [0]
    Čunjevi (Gost) (unjevig) [0]
    Čunjevi (cunjeviukupno) [0]
    Nastup (doma) (nastupdoma) [0]
    Nastup (gost) (nastupgost) [0]
    Set (set) [2]
    Čunjevi (doma) (unjevid) [3]

    Stupci tabele: Poeni(+) (poeni = $poenafor) [0] {2 ↑}
    Setovi(+) (setovi = $setovafor) [0] {3 ↑}
    Utakmica (utakmica = $eventsplayed) [1]
    Pobjeda (pobjeda = $pobjeda) [2]
    Neriješeno (nerijeeno = $nerijeeno) [3]
    Poraz (poraz = $poraz) [4]
    Bodovi (bodovi = $bodfor) [5] {1 ↑}
    Poeni(-) (poeni-2 = $poenaagainst) [7]
    Setovi(-) (setovi-2 = $setovaagainst) [9]
    Ukupno čunjeva (ukupnounjeva = $ucunjevafor) [10]

    Player Metrics: Datum rođenja (datumroenja) [0]
    Pravo nastupa (pravonastupa) [0]

    Player Statistics: Prosjek u gostima (prosjekugostima = $unjevig / $nastupgost) [0]
    temp ( = ) [0]
    temp (temp = $unjevig + ( $unjevid / $nastupdoma ) / $nastupgost + 1) [0]
    Utakmica (utakmica = $eventsstarted) [0]
    Broj nastupa u gostima ( = ) [0]
    Poena (poena = $poen) [2]
    Setova (setova = $set) [3]
    Ukupno čunjeva (ukupnounjeva = $cunjeviukupno) [4]
    Prosjek (prosjek = $cunjeviukupno / $eventsattended) [5]

    ### SP Taxonomies ###

    Competitions: 2. HKL sjever (2-hkl-sjever)
    3. HKLS zona Bj-Sk (3-hkls-zona-bj-sk)
    3. HKLS zona Varaždin (3-hkls-zona-varazdin)

    Sezone: 2014/2015 (20142015)
    Lokacije: Gradska kuglana Novska (gradska-kuglana-novska)
    ŠRC Mladost Čakovec (src-mladost-cakovec)

    Positions: Junior (junior)
    Senior (senior)
    Veteran (veteran)

    ### SP Post Types ###

    Zbivanja: 3 publish
    0 future
    0 draft
    0 private
    0 trash
    0 auto-draft
    0 inherit

    Kalendar: 0 publish
    0 future
    0 draft
    0 private
    0 trash
    0 auto-draft
    0 inherit

    Ekipe: 5 publish
    0 future
    0 draft
    0 private
    0 trash
    0 auto-draft
    0 inherit

    Tablica lige: 1 publish
    0 future
    0 draft
    0 private
    0 trash
    0 auto-draft
    0 inherit

    Igrači: 71 publish
    0 future
    0 draft
    0 private
    0 trash
    0 auto-draft
    0 inherit

    Popis igrača: 1 publish
    0 future
    1 draft
    0 private
    0 trash
    0 auto-draft
    0 inherit

    Staff: 0 publish
    0 future
    0 draft
    0 private
    0 trash
    0 auto-draft
    0 inherit

    ### Tema ###

    Ime teme: Inkzine
    Verzija teme: 1.0.4
    Author URL: http://inkhive.com

    ### Predlošci ###

    Template Overrides: Nije prisutno nadjačavanje u temi

    lukodp

    (@lukodp)

    Sorry for bumping the topic but I’ll try to explain further what I need.
    I have this variables in player performance:
    1. unjevig
    2. unjevid
    3. nastupdoma
    4. nastupgost
    I want to calculate something like this:
    =unjevig + ( unjevid / nastupdoma ) / nastupgost + 1
    Only thing that worked with brackets was this formula:
    =( unjevig + unjevid) / ( nastupgost + 1 )

    Does the nested brackets work?
    Everything else is throwing mismatched parentheses error. I updated plugin to version 1.6

    lukodp

    (@lukodp)

    Ok. I figured it out …
    It looks to me that equation builder isn’t supporting nested brackets. Without that there is no way (as far as I know) to solve this formula. To bad..
    🙁

    Plugin Author Brian

    (@brianmiyaji)

    @lukodp You’re right, the equation is throwing an error even though it should be working. The reason this is happening is because of a zero-denominator check in sp-core-functions.php: line 1091

    if ( $eos->solveIF( substr( $equation, $pos + 1 ), $vars ) == 0 )
    				return 0;

    The check is attempting to solve the equation after the first “÷”, throwing a mismatched parantheses error because the equation being checked is something like:

    nastupdoma ) ) / ( nastupgost + 1 )

    I’ll need to fix this part of the check so that it looks for a denominator with matching parentheses instead i.e.

    0 !== ( nastupgost + 1 )

    For now, a temporary solution (if you’re sure that the denominator will not be zero) is to comment out the lines in sp-core-functions.php between 1089-1093.

    I’ll add this issue to our GitHub project for fixing in the next update.

    Plugin Author Brian

    (@brianmiyaji)

    A more permanent solution added to core: https://github.com/ThemeBoy/SportsPress/commit/813eb3fe9001195f6f2ebb650c5bf6a261654ca9

    This checks each sub-equation by splitting the equations wherever a division occurs, then looks at that equation if the parentheses match and return zero if that sub-equation is zero.

    This version of the zero-denominator check also works properly with your equation 🙂

    Hy,

    I actually give up from that project because of this issue.
    Now I’m starting it again here: http://regijasjever.com.hr/
    Can’t describe how thankful I am 🙂

    Best regards,

    Luko

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Problem with using bracket operator in player statistic’ is closed to new replies.