• wmuys

    (@wmuys)


    Lamonte,

    I noticed that the sorting rules for the standings table are not correct for soccer. When two teams have equal points, but one team has played less games, the latter team is higher in the standings. I have modified soccer.php to reflect this. Can you add this in a future release?
    I have added the variable $done to the multi sort array as follows (lines 61 and beyond)

    /**
    	 * rank Teams
    	 *
    	 * @param array $teams
    	 * @return array of teams
    	 */
    	function rankTeams( $teams )
    	{
    		foreach ( $teams AS $key => $row ) {
    			$points[$key] = $row->points['plus']+$row->add_points;
    			$diff[$key] = $row->diff;
    			$goals[$key] = $row->points2['plus'];
    			$done[$key] = $row->done_matches;
    		}
    		array_multisort( $points, SORT_DESC, $done, SORT_ASC, $diff, SORT_DESC, $goals, SORT_DESC, $teams );
    		return $teams;
    	}

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    https://wordpress.org/plugins/leaguemanager/

Viewing 1 replies (of 1 total)
  • Plugin Author LaMonte Forthun

    (@lamontef)

    Makes sense, I’ll update it…

    One of the bigger modifications I’ve been working on for a while is a custom ‘tiebreaker’ system that would allow a user to choose how standings are sorted. I had gotten quite a bit done last year when I was working heavy on the plugin, but when I ended up working on a rather large project I had to devote all my time to that. I’m going to jump back on that once I get the code cleaned up and some of the nagging bugs fixed…

    Thanks for the input, I appreciate it.

Viewing 1 replies (of 1 total)
  • The topic ‘Standings for soccer’ is closed to new replies.