Shoal Summit Solutions › Forums › MSTW League Manager Plugin (& Add-ons) › Deduction of points for non played fixture
- This topic has 4 replies, 2 voices, and was last updated 4 years, 10 months ago by Mark.
-
AuthorPosts
-
March 6, 2020 at 3:29 am #5961
Hi, I’m trying to get League Manager to deduct points from a team that has failed to play a fixture. Presently we award 3 points for a win, two points for a draw, and 1 point for turning up and playing the fixture, but losing. However, if a team cancels the fixture then we award the game to the opposition and deduct 2 points from the team cancelling the fixture. It has been suggested we use the Overtime Loss to record the deduction of points using the following skeleton formula from Mark:
add_filter( ‘mstw_lm_percent_calc’, ‘my_percent_calc’, 10, 2 );
function my_percent_calc( $percent, $record ) {
// $percent is the win percentage calculated with the formula above
// $record is an array which includes the elements:
// $record[‘wins’], $record[‘losses’], $record[‘ties’], $record[‘ot_wins’], $record[‘ot_losses’]// $new_win_percent = your win percentage calculation (code defensively: check for existence, type, value!)
// it is very important to return the new win percentage!!
return $new_win_percent;
}I’m having some trouble getting this to work? The website page is https://bwwpl.com/2020-fixtures-result. Any help would be gratefully welcomed.
March 6, 2020 at 7:47 am #5962Hi Mike,
First, could I see the function you are actually using? The one you cut in appears to be a sample and won’t work at all.But before that, it looks like you are trying to do a POINTS calculation using the PERCENT calculation filter. How does that make sense?
Let me know.
-MarkMarch 8, 2020 at 7:01 pm #5972Mike,
I checked this out, and it turns out you don’t need the filters. The admin screen for standings does it for you. (At least it did for me.)Here’s a screenshot of the settings I used in the admin screen:
https://shoalsummitsolutions.com/wp-content/uploads/Negative-Points-Test-Admin.pngHere’s a screenshot of the resulting standings (shortcode):
https://shoalsummitsolutions.com/wp-content/uploads/Negative-Points-Test-Shortcode.pngIt looks to me like everything works as you need it to out of the box.
Let me know.
-Mark
March 9, 2020 at 3:29 am #5975Hi Mark, thanks for your reply. Had already tried this as you will see from this screenshot: https://bwwpl.com/wp-content/uploads/2020/03/Screenshot_2-copy.jpg
However, this is the result I get:
https://bwwpl.com/wp-content/uploads/2020/03/Screenshot_1-copy.jpgAs you will see under the heading Cancelled Matches which is the OTL field, it puts in the slug name for some reason?
Mike Coles
March 9, 2020 at 2:53 pm #5978Hi Mike,
It looks like we are back to where we started ….
Please note that AUTOFILL STANDINGS IS CHECKED on your settings screenshot. This will NOT work (at the moment) with AUTOFILL STANDINGS because there is no way to enter overtime wins and losses. So you have to uncheck the Autofill Standings and then enter the team records manually. (The Update Records screen does allow entry of OT wins and losses.)
Sorry for the misunderstanding.
-Mark -
AuthorPosts
- You must be logged in to reply to this topic.