The basketball ‘sports’ file has a few problems that you’ll most likely run into, such as how it adds scores for an overtime game. I’ve made a number of changes to this particular file, so if you would like to see it I can send it with explanations of what I did.
The matter at hand though is fairly simple and I think will give you what you want for your standings. If you’re using the basketball rules, I was mistaken about why you’re results aren’t working as you want. What’s happening with the basketball rules is the sort is points first, then basket differential, then games played.
Open the basketball.php file in the the ‘sports’ folder and find the following at line 71:
$diff[$key] = $row->diff;
}
array_multisort( $points, SORT_DESC, $diff, SORT_DESC, $done, SORT_ASC, $teams );
Replace the above with this (I’ve removed the indents to make it easier to read):
$diff[$key] = $row->diff;
$GA[$key] = ($row->points2_plus)/($row->points2_minus);
$WinPerc[$key] = (($row->won_matches) > 0 ? (($row->lost_matches) > 0 ? (($row->won_matches)/($row->lost_matches)) : 1.00) : 0.00);
}
array_multisort( $points, SORT_DESC, $WinPerc, SORT_DESC, $GA, SORT_DESC, $teams );
The first line hasn’t changed, the rest is what you need.
What this does is this:
$GA[$key] gives you a baskets for/baskets against ratio
$WinPerc[$key] gives you a win percentage taking into account division by zero issues.
The new sort is based first on points, then win percentage, then for/against ratio
So far it seems to be how I want it to, so I think everything is ok, but let me know if you