• Resolved af3

    (@af3)


    Hi, i think the group winner table is not sorted correctly. For example, this Group B (Euro 2020):

    
    		w	d	l		
    Belgium	3	3	0	0	9	(7-1)
    Finland	3	1	0	2	3	(1-3)
    Denmark	3	1	0	2	3	(5-4)
    Russia	3	1	0	2	3	(2-7)
    

    Denmark should be on top of Finland because the goal diff is +1 whereas Finland is -2. How to fix this?

Viewing 8 replies - 1 through 8 (of 8 total)
  • I have this same problem. I tried to change the order in the team settings in the admin panel but it also doesn’t work.

    Plugin Author AntoineH

    (@antoineh)

    These rules change between tournaments, seems like the result between two teams is no longer a tie-breaker or I am applying it wrongly 😉

    I will re-think how I want to solve this for future tournaments because officially the rules for UEFA 2020 are as follows:

    Article 15 Equality of points – qualifying group stage

    15.01 If two or more teams in the same group are equal on points on completion of the
    qualifying group stage, the following criteria are applied, in the order given, to
    determine their rankings:

    a. higher number of points obtained in the group matches played among the teams in question;
    b. superior goal difference from the group matches played among the teams in question;
    c. higher number of goals scored in the group matches played among the teams in question;
    d. higher number of goals scored away from home in the group matches played
    among the teams in question;
    e. if, after having applied criteria a) to d), teams still have an equal ranking, criteria a) to d) are reapplied exclusively to the matches between the remaining teams to determine their final rankings. If this procedure does not lead to a decision, criteria f) to l) apply in the order given to the two or more teams still equal;
    f. superior goal difference in all group matches;
    g. higher number of goals scored in all group matches;
    h. higher number of away goals scored in all group matches;
    i. higher number of wins in all group matches;
    j. higher number of away wins in all group matches;
    k. lower disciplinary points total based only on yellow and red cards received in all group matches (red card = 3 points, yellow card = 1 point, expulsion for two yellow cards in one match = 3 points);
    l. position in the overall UEFA Nations League rankings (see Regulations of the UEFA Nations League).

    And no way that I can put this in code 😉 (because I don’t even have all the data). So maybe I will keep it as simple as possible and then have the manual sort number as an ultimate tie-breaker.

    For now you can do the following: change the compare_teams() method in the /classes/class-football-pool-groups.php file to:

    	public static function compare_teams( $a, $b ) {
    		// if points are equal
    		if ( $a['points'] === $b['points'] ) {
    			// check if they have the same number of plays
    			if ( $a['plays'] === $b['plays'] ) {
    				// check goal difference
    				if ( ( $a['for'] - $a['against'] ) === ( $b['for'] - $b['against'] ) ) {
    					// now check the goals scored
    					if ( $a['for'] === $b['for'] ) {
    						// all failed, so we check a hardcoded ordering
    						$teams = new Football_Pool_Teams;
    						return ( $teams->get_group_order( $a['team'] ) > $teams->get_group_order( $b['team'] ) ? +1 : -1 );
    					}
    					// the one with more goals wins (descending order)
    					return ( $a['for'] < $b['for'] ) ? +1 : -1;
    				}
    				// the one with more goals wins (descending order)
    				return ( ( $a['for'] - $a['against'] ) < ( $b['for'] - $b['against'] ) ? +1 : -1 );
    			}
    			// the one with the least plays has the advantage
    			return ( $a['plays'] > $b['plays'] ) ? +1 : -1;
    		}
    		// order descending
    		return ( $a['points'] < $b['points'] ) ? +1 : -1;
    	}
    

    I think this will work.

    • This reply was modified 2 years, 10 months ago by AntoineH. Reason: layout

    Yes, now it’s working.
    1

    Thread Starter af3

    (@af3)

    Group B is fixed but actually in Group F, Germany should be above Portugal (yes, I also do not know why — could be because Germany has less against goals compared to Portugal ?

    Plugin Author AntoineH

    (@antoineh)

    If I understand the rules I posted yesterday, correctly, then it will be very complex (or maybe even impossible) to sort the teams with a one on one compare like I have know. In case 2 or more teams end up with the same amount of points, I need to get the points and goals scored for the matches of (only) those teams involved within the group phase. Currently it takes the goals scored for all matches.

    Maybe I will just use the manual overwrite sooner. Don’t think putting a lot of effort in getting this done in code will pay off in the end. As mentioned before in another topic, the plugin is not a UEFA-only tool, but used for national competitions, the FIFA world cup and other sports as well. There is no way I can find something that fits all and then I better choose the simplest, manual, solution with an option to overwrite for a specific use case.

    I think the best possible option is to leave the default settings and add the ability to assign “by finger” place in the table.

    Thread Starter af3

    (@af3)

    Hi @antoineh you are right, i think the manual ordering would be a great tool as the rules are so complex for different types of sports. The one you have is already working but the levels of rules are so deep, it doesnt make sense to capture all them in codes.

    +1 for manual sort after current general rules.

    Plugin Author AntoineH

    (@antoineh)

    I just released a bug fix release with some minor updates (v2.9.6). Something that I would normally not do during a big tournament, but let’s hope I didn’t mess things up 😉

    With this update there is also the option to hook into the group sorting. So for version 2.9.6 and up this plugin will allow to overwrite the sorting with the manual group order number that is stored with a team. I checked and for most groups this already works fine. For Wales I had to set the number to something lower than Switzerland (I set it to 1) to fix the sorting.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Group Winner Table’ is closed to new replies.