WordPress.org

Ready to get started?Download WordPress

Forums

LeagueManager
[resolved] Points Ranking (6 posts)

  1. ibzzie
    Member
    Posted 6 months ago #

    Trying to get points ranking to order by points taken and points given.
    For example: 12-0 should rank above 12-9.
    Using the score system.

    http://unveiledcodex.co.uk/leagues/hearthstone

    How would I be able to do this?

  2. LaMonte Forthun
    Member
    Plugin Author

    Posted 6 months ago #

    Are you ranking by winning percentage? If so that's a fairly easy adjustment and could be accomplished by one of the other sports files. I think I had built that into baseball, so if we need to build a sport file for your particular need, we can do that.

  3. ibzzie
    Member
    Posted 6 months ago #

    The system is each match is a set of 3 games. First to 3 and each game one is 3 points.

    Want to rank by the first set of points first and if they're equal then to rank by the second set so for example:

    21 - 6
    18 - 0
    18 - 6
    18 - 9
    15 - 3
    12 - 0

    etc.

  4. LaMonte Forthun
    Member
    Plugin Author

    Posted 6 months ago #

    As a temporary solution, try this:

    Go to your league's preference settings, in the 'Point Rule' setting select 'User defined'. You'll get five boxes that allow you to set how points are awarded for wins, wins in overtime, ties, losses, and losses in overtime. It looks like you are awarding three points for a win, so set the first box to 3, then set the fourth box to -0.01. This way the losses will be negative, but not so much as to drop an 18-9 team below a 15-3 team. On the standings page only integers are shown, but in the database the numbers are floating with two decimal points.

  5. ibzzie
    Member
    Posted 6 months ago #

    Thanks, found a more permanent solution. Your hint about sports files made me create a custom sport that had this as its rank team method:

    function rankTeams( $teams )
    	{
    		foreach ( $teams AS $key => $row ) {
    			$plus[$key] = $row->points['plus'] + $row->add_points;
    			$minus[$key] = $row->points['minus'];
    			$done[$key] = $row->done_matches;
    		}
    
    		array_multisort($plus, SORT_DESC, $minus, SORT_ASC, $done, SORT_ASC, $teams);
    		return $teams;
    	}
  6. LaMonte Forthun
    Member
    Plugin Author

    Posted 6 months ago #

    Excellent, an even better solution that you can tweak if needed...

Reply

You must log in to post.

About this Plugin

About this Topic