Code Submission: Forfeits shouldn't be automatically -1 pts

Questions about modifications to Zuluru code, to add or change features

Code Submission: Forfeits shouldn't be automatically -1 pts

Postby sulfur » Thu Jan 09, 2014 9:16 am

Not all leagues (or sports for that matter) treat forfeits as -1 points. I add a couple of quick lines of code to handle this in the same way that the win, loss, and tie/draw values are calculated.

controllers/components/league_type.php:
Code: Select all
262   262             ++ $results[$team]['rounds'][$round]['def'];
263      -         -- $points;
   263   +         $points += $this->sport_obj->forfeitValue();
264   264          }


controllers/components/sport.php:
Code: Select all
42   42   
   43   +   function forfeitValue() {
   44   +      return -1;
   45   +   }
   46   +   
43   47       function _init_rosters($stats) {


I left the various team sports as is for the time being (since they inherit the forfeitValue() from sport.php, but it makes things a bit more configurable for people in that sense.
sulfur
 
Posts: 38
Joined: Fri Nov 08, 2013 3:08 pm
Location: Kingston, ON

Return to Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron