Page 1 of 1

OBBLM - How to make a house rule that uses sdiff to sort?

Posted: Sat Jan 11, 2014 4:52 pm
by Bakdal
My league has just started up a new season and this year we wanted to sort the standings slightly different than the standard HRS options.

The idea was to sort the standings against points and if points were tied then against sdiff. The plan was that points would be awarded in the normal way of win=3 points, tie = 2 points, and loss = 1 point. However I most have gotten something wrong as after the first match both teams got 0 points in the standings after a 1-0 match.

Heres the code defining the House ranking systems from the settings.php file.

Code: Select all

// Rule #5
$hrs[5]['rule']   = array('-pts', '-sdiff');    // Sort teams against: most points, then highest GF-GA.
$hrs[5]['points'] = '3*[won] + 2*[draw] + 1*[lost]'; // The definition of points.
Here's the code from the local settings file also, though I don't think it should matter much as the standings box is set for tournament.

Code: Select all

$settings['fp_standings'] = array(
    # This will display a standings box of the top 6 teams in node (league, division or tournament) with ID = 1
    array(
        'id'     => 11,
        'box_ID' => 2,
        // Please note: 'type' may be either one of: 'league', 'division' or 'tournament'
        'type'   => 'tournament', # This sets the node to be a tournament. I.e. this will make a standings box for the tournament with ID = 1
        'infocus' => true, # If true a random team from the standings will be selected and its top players displayed.
        /*
            The house ranking system (HRS) NUMBER to sort the table against.
            Note, this is ignored for "type = tournament", since tours have an assigned HRS.
            Also note that using HRSs with fields such as points (pts) for leagues/divisions standings makes no sense as they are tournament specific fields (i.e. it makes no sense to sum the points for teams across different tours to get the teams' "league/division points", as the points definitions for tours may vary).
        */
        'HRS'    => 5, # Note: this must be a existing and valid HRS number from the main settings.php file.
        'title'  => 'The Full Bucket MMXIII Standings',
        'length' => 8,
        # Format: "Displayed table column name" => "OBBLM field name".
        'fields' => array('Name' => 'name', 'PTS' => 'pts', 'TV' => 'tv', 'CAS' => 'cas', 'W' => 'won', 'L' => 'lost', 'D' => 'draw', 'GF' => 'gf', 'GA' => 'ga',),
Site is located at kfc.bakdal.eu Any help getting this standings/HRS thing solved would be appreciated.

Re: OBBLM - How to make a house rule that uses sdiff to sor

Posted: Sat Jan 11, 2014 7:29 pm
by Shteve0
Your code looks fine. The problem is, as you point out, not in the box on the front page, but in the resolution of the house ranking code - it's sorting by the right things, it's just not calculating the points correctly.

After adding HRS Rule 5, did you re-install the database back end procedures in the core panel?

Re: OBBLM - How to make a house rule that uses sdiff to sor

Posted: Sun Jan 12, 2014 8:15 am
by Bakdal
Shteve0 wrote:Your code looks fine. The problem is, as you point out, not in the box on the front page, but in the resolution of the house ranking code - it's sorting by the right things, it's just not calculating the points correctly.

After adding HRS Rule 5, did you re-install the database back end procedures in the core panel?
I thought I did… but apparently I didn't. Because after doing so (and clearing my browser cache) the PTS column in the standings are showing correctly.
Thanks for looking over the code Shteve0 and reminding me to re-install the database back end procedures. Everything looks fine now.

Posted: Sun Jan 12, 2014 8:26 am
by Shteve0
No trouble, glad you got it sorted :)

Re: OBBLM - How to make a house rule that uses sdiff to sor

Posted: Thu Jul 02, 2015 10:21 pm
by sann0638
So is it possible to add in as many different "scoring options" as you want by changing the settings.php file?

Re: OBBLM - How to make a house rule that uses sdiff to sor

Posted: Sun Jul 05, 2015 6:12 am
by Shteve0
Sorry, I thought I'd replied to this.

Yes - within reason. I guess it depends how many you want and what those options are.