OBBLM: Division Leader Boxes

However you play online - Java, Vassal, Email, Cyanide etc - talk about it here.
This is also the place for discussing the various tools for managing leagues, teams and so on.

Moderator: TFF Mods

Post Reply
User avatar
ChenZhen
Emerging Star
Emerging Star
Posts: 456
Joined: Sun Dec 11, 2011 3:30 am
Location: Twin Cities, MN - USA
Contact:

OBBLM: Division Leader Boxes

Post by ChenZhen »

I've not been able to figure out how to set up a leader box to track teams in CAS, Defense, and TD's over a season. I want to have teams ranked by team stats (not individual players and individual stats).

Our league structure is 2 divisions (Bloodweiser and Bugman's). At the end of a season, the top 4 teams in each division have a single elimination playoff, and the two division winners play for the season championship.

The way I set up the t3fl.com site was to create a new division for each season, and then a tournament for each division. The leader boxes for each of these have been working fine.

Code: Select all

$settings['fp_standings'] = array(
    array(
        'id'     => 14, # Node ID
        'box_ID' => 1,
        // 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'    => 1, # Note: this must be a existing and valid HRS number from the main settings.php file.
        'title'  => 'Bloodweiser Division: Season 4', # Table title
        'length' => 16, # Number of entries in table
        # Format: "Displayed table column name" => "OBBLM field name". For the OBBLM fields available see http://nicholasmr.dk/obblmwiki/index.php?title=Customization
        'fields' => array('Name' => 'name', 'GP' => 'played', 'W' => 'won', 'D' => 'draw', 'L' => 'lost', 'PTS' => 'pts', 'GF' => 'gf', 'GA' => 'ga', 'TCAS' => 'tcasf', 'TV' => 'tv',),
    ),
    array(
        'id'     => 15, # Node ID
        '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'    => 1, # Note: this must be a existing and valid HRS number from the main settings.php file.
        'title'  => 'Bugman\'s Divison: Season 4', # Table title
        'length' => 16, # Number of entries in table
        # Format: "Displayed table column name" => "OBBLM field name". For the OBBLM fields available see http://nicholasmr.dk/obblmwiki/index.php?title=Customization
        'fields' => array('Name' => 'name', 'GP' => 'played', 'W' => 'won', 'D' => 'draw', 'L' => 'lost', 'PTS' => 'pts', 'GF' => 'gf', 'GA' => 'ga', 'TCAS' => 'tcasf', 'TV' => 'tv',),
    ),
);
I want to sort the leaders by the following tiebreakers:
CAS: -cas, -ki, -si, -bh
DEF: +ga, -wins, -sdiff
TD: -gf, -wins, -sdiff

Is this something that is possible to do at division level? Is there a different way to do this?

Any help is appreciated!

Reason: ''
User avatar
Shteve0
Legend
Legend
Posts: 2479
Joined: Thu May 07, 2009 10:15 am
Location: Wellington, New Zealand

Post by Shteve0 »

Hmmm. Is this not setting a division box rather than a tournament leader box ('type' = 'division'? The sort order is specified by the HRS (contained in settings.php). If you're adding a new hrs (house ranking system) then its best practice to add it at the end and resync your database.

Reason: ''
League and tournament hosting, blogging and individual forums - all totally free. For the most immersive tabletop sports community experience around, check out theendzone.co
User avatar
ChenZhen
Emerging Star
Emerging Star
Posts: 456
Joined: Sun Dec 11, 2011 3:30 am
Location: Twin Cities, MN - USA
Contact:

Re:

Post by ChenZhen »

Shteve0 wrote:Hmmm. Is this not setting a division box rather than a tournament leader box ('type' = 'division'? The sort order is specified by the HRS (contained in settings.php). If you're adding a new hrs (house ranking system) then its best practice to add it at the end and resync your database.
Yes. I ran into a snag with the HRS.

Code: Select all

// Rule #1
$hrs[1]['rule']   = array('-pts', '-won', '-sdiff', '-elo', '-tcasf', '-ki', '-si', '-bh');    // Sort teams against: most points, then most wins, then most TD's for - TD's against, then most team cas, then most kills, then most Serious Injuries, then most Badly Hurts.
$hrs[1]['points'] = '5*[won] + 3*[draw] + 1*[lost]'; // The definition of points.

// Rule #2
$hrs[2]['rule']   = array('-pts', '-win_pct', '-sdiff', '-tcasf', '-ki', '-si', '-bh'); // Sort teams against: most points, then win percentage, then most TD's for - TD's against, then most team cas, then most kills, then most Serious Injuries, then most Badly Hurts..
$hrs[2]['points'] = '5*[won] + 3*[draw] + 1*[lost]]';            // The definition of points.

// Rule #3
$hrs[3]['rule']   = array('-sdiff', '-smp'); // Sort teams against: largest score difference, then most sportsmanship points.
$hrs[3]['points'] = '';                      // Points not used.

// Rule #4
$hrs[4]['rule']   = array('-cas', '-ki', '-si', '-bh'); // CAS Title Sort teams against: most CAS, then most Kills, then most SI, then most BH.
$hrs[4]['points'] = '';                      // Points not used.

// Rule #5
$hrs[5]['rule']   = array('+ga', '-wins', '-sdiff'); // DEF Title Sort teams against: fewest goals allowed, then most wins, then greatest score differential.
$hrs[5]['points'] = '';                      // Points not used.

// Rule #6
$hrs[6]['rule']   = array('-gf', '-wins', '-sdiff'); // TD Title Sort teams against: largest score difference, then most sportsmanship points.
$hrs[6]['points'] = '';                      // Points not used.
I think this all should work, but when I ran the "Re-Install database back-end procedures and fuctions" I got an error code.

FATAL ERROR: One or more OBBLM MySQL functions/procedures could not be created. This error is most likely due to your database user NOT having the "CREATE ROUTINE" privilege. Some web hosts are willing to help you work around this problem by running this install/upgrade script for you. If not, you will have to find another web host allowing "CREATE ROUTINE".

MySQL error (errno 1064):
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '] FROM mv_teams WHERE f_tid = tid AND f_trid = trid); ELSE RETU' at line 13

The function/procedure SQL code that failed was:
CREATE FUNCTION getPTS(tid MEDIUMINT UNSIGNED, trid MEDIUMINT UNSIGNED) RETURNS FLOAT SIGNED NOT DETERMINISTIC READS SQL DATA BEGIN DECLARE rs TINYINT UNSIGNED DEFAULT NULL; SELECT tours.rs INTO rs FROM tours WHERE tour_id = trid; IF rs IS NULL THEN RETURN NULL; END IF; CASE rs WHEN 1 THEN RETURN (SELECT 5*IFNULL(SUM(won),0) + 3*IFNULL(SUM(draw),0) + 1*IFNULL(SUM(lost),0) FROM mv_teams WHERE f_tid = tid AND f_trid = trid); WHEN 2 THEN RETURN (SELECT 5*IFNULL(SUM(won),0) + 3*IFNULL(SUM(draw),0) + 1*IFNULL(SUM(lost),0)] FROM mv_teams WHERE f_tid = tid AND f_trid = trid); ELSE RETURN 0; END CASE; RETURN NULL; END

I'm contacting the Mercury VPS to see if they can run this for me.

Reason: ''
User avatar
ChenZhen
Emerging Star
Emerging Star
Posts: 456
Joined: Sun Dec 11, 2011 3:30 am
Location: Twin Cities, MN - USA
Contact:

Re: OBBLM: Division Leader Boxes

Post by ChenZhen »

I believe I have it all working now. We will see once the season starts. :wink:

Code: Select all

$settings['fp_standings'] = array(
    array(
        'id'     => 14, # Node ID
        'box_ID' => 1,
        // 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'    => 1, # Note: this must be a existing and valid HRS number from the main settings.php file.
        'title'  => 'Bloodweiser Division: Season 4', # Table title
        'length' => 16, # Number of entries in table
        # Format: "Displayed table column name" => "OBBLM field name". For the OBBLM fields available see http://nicholasmr.dk/obblmwiki/index.php?title=Customization
        'fields' => array('Name' => 'name', 'GP' => 'played', 'W' => 'won', 'D' => 'draw', 'L' => 'lost', 'PTS' => 'pts', 'GF' => 'gf', 'GA' => 'ga', 'TCAS' => 'tcasf', 'TV' => 'tv',),
    ),
    array(
        'id'     => 15, # Node ID
        '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'    => 1, # Note: this must be a existing and valid HRS number from the main settings.php file.
        'title'  => 'Bugman\'s Divison: Season 4', # Table title
        'length' => 16, # Number of entries in table
        # Format: "Displayed table column name" => "OBBLM field name". For the OBBLM fields available see http://nicholasmr.dk/obblmwiki/index.php?title=Customization
        'fields' => array('Name' => 'name', 'GP' => 'played', 'W' => 'won', 'D' => 'draw', 'L' => 'lost', 'PTS' => 'pts', 'GF' => 'gf', 'GA' => 'ga', 'TCAS' => 'tcasf', 'TV' => 'tv',),
    ),
    array(
        'id'     => 9, # Node ID
        'box_ID' => 3,
        // Please note: 'type' may be either one of: 'league', 'division' or 'tournament'
        'type'   => 'division', # This sets the node to be a tournament. I.e. this will make a standings box for the tournament with ID = 1
        'infocus' => false, # 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'    => 4, # Note: this must be a existing and valid HRS number from the main settings.php file.
        'title'  => 'CAS Leaders: Season 4', # Table title
        'length' => 10, # Number of entries in table
        # Format: "Displayed table column name" => "OBBLM field name". For the OBBLM fields available see http://nicholasmr.dk/obblmwiki/index.php?title=Customization
        'fields' => array('Name' => 'name', 'CAS' => 'cas','KI' => 'ki', 'SI' => 'si','BH' => 'bh',),
    ),
        array(
        'id'     => 9, # Node ID
        'box_ID' => 4,
        // Please note: 'type' may be either one of: 'league', 'division' or 'tournament'
        'type'   => 'division', # This sets the node to be a tournament. I.e. this will make a standings box for the tournament with ID = 1
        'infocus' => false, # 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'  => 'Defense Leaders: Season 4', # Table title
        'length' => 10, # Number of entries in table
        # Format: "Displayed table column name" => "OBBLM field name". For the OBBLM fields available see http://nicholasmr.dk/obblmwiki/index.php?title=Customization
        'fields' => array('Name' => 'name', 'GA' => 'ga', 'W' => 'won', 'SDIFF' => 'sdiff',),
    ),
        array(
        'id'     => 9, # Node ID
        'box_ID' => 5,
        // Please note: 'type' may be either one of: 'league', 'division' or 'tournament'
        'type'   => 'division', # This sets the node to be a tournament. I.e. this will make a standings box for the tournament with ID = 1
        'infocus' => false, # 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'    => 6, # Note: this must be a existing and valid HRS number from the main settings.php file.
        'title'  => 'TD Leaders: Season 4', # Table title
        'length' => 10, # Number of entries in table
        # Format: "Displayed table column name" => "OBBLM field name". For the OBBLM fields available see http://nicholasmr.dk/obblmwiki/index.php?title=Customization
        'fields' => array('Name' => 'name', 'TD' => 'td', 'W' => 'won', 'SDIFF' => 'sdiff',),
    ),
);

Reason: ''
User avatar
ChenZhen
Emerging Star
Emerging Star
Posts: 456
Joined: Sun Dec 11, 2011 3:30 am
Location: Twin Cities, MN - USA
Contact:

Re: OBBLM: Division Leader Boxes

Post by ChenZhen »

I found the problems. I had typed "wins" instead of "won" in the HRS, and I had an extra "]" placed in the code. Once I took those out, everything worked swimmingly!

I'm really happy now that the league standings are grouped by divisions, as are the standings for CAS, DEF, and TD titles!

The code has been a bit trial and error, but it is really satisfying when you get it to do what you want! :lol: :lol: :lol:

Reason: ''
Post Reply