Changeset 306 for trunk/leaguerunner

Show
Ignore:
Timestamp:
08/11/05 09:27:17 (5 years ago)
Author:
dan
Message:
 
Location:
trunk/leaguerunner/src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/leaguerunner/src/classes/league.inc

    r303 r306  
    930930 
    931931                # sort team's so that pyramid scheme can work properly 
    932       // TODO: MAKE SURE TO TEST THIS....... IT'S NOT FULLY TESTED!!!!!! 
    933                 // HACK: ugly... have to call the calculate_standings method to be able to get 
    934       //  game info so that the ladder sort can use SOTG as the second criteria... 
    935       // Otherwise, I could just do: 
    936       //   $teams = $this->teams; 
    937       //   uasort($teams, 'standings_sort_ladder_tony'); 
    938932      $teams = array(); 
    939933      list($team_ids, $junk, $morejunk) = $this->calculate_standings(); 
     
    10881082    * This does the actual work of scheduling a one set pyramid set of games. 
    10891083    * However it has some problems where it may not properly schedule all 
    1090     * the games.  If it runs into problems then we use the wrapper  
     1084    * the games.  If it runs into problems then we use the wrapper 
    10911085    * function that calls this one to retry it. 
     1086    * If any problems are found then this function rolls back it's changes. 
    10921087    */ 
    1093         function schedule_one_set_pyramid_try( $teams,  
    1094                                           $datestamp,  
     1088    function schedule_one_set_pyramid_try( $teams, 
     1089                                          $datestamp, 
    10951090                                          $games_before_repeat 
    10961091                                        ) 
    1097         { 
    1098       //TODO: use transactions 
    1099                 $rollback_list = array(); 
     1092    { 
     1093      $rollback_list = array(); 
    11001094 
    11011095      $versus_team1 = array(); 
     
    11261120         $team = array_shift($teams); 
    11271121         // gotta load this team's games to see who they've played recently... 
    1128          $past_games = game_load_many( array( 'either_team' => $team->team_id,  
     1122         $past_games = game_load_many( array( 'either_team' => $team->team_id, 
    11291123                                              '_order' => 'g.game_date') ); 
    11301124         if ($past_games == null) 
     
    12001194         $versus_team1[] = $team; 
    12011195         $versus_team2[] = $opponent; 
    1202  
    1203          //print "Matching " . $team->team_id . " " . $opponent->team_id . "\n"; 
    12041196      } 
    12051197 
     
    12241216         list($rc, $message) = $g->select_weighted_gameslot($datestamp); 
    12251217         if( ! $rc ) { 
    1226             print "$rc: $message"; 
    1227             // Argh, something failed, so roll back the whole pile of games  
     1218            // something failed, so roll back the whole pile of games 
    12281219            foreach( $rollback_list as $to_rollback ) { 
    12291220               if( ! $to_rollback->delete() ) { 
     
    12521243         for ($j = 0; $j < $max_retries; $j++) { 
    12531244            /* 
    1254             * this returns "REPEAT" if it needs to get repeated 
     1245            * if we get back "REPEAT" then we can try again because it didn't work 
     1246            * in finding a set of matches for everyone given the paramters we gave it. 
     1247            * After a while we lower our requirements and try again.  The randomizing 
     1248            * inside this function will make it work sometimes and fail others, but 
     1249            * eventually we'll get a good matchup. 
    12551250            */ 
    12561251            $ret = $this->schedule_one_set_pyramid_try( $teams, $datestamp, $i); 
     
    14311426} 
    14321427 
    1433 function standings_sort_ladder_tony (&$a, &$b)  
    1434 { 
    1435    /* Check Rank */ 
    1436    if ($a->rank != $b->rank) { 
    1437       return ($a->rank < $b->rank) ? -1 : 1; 
    1438    } 
    1439  
    1440    /* Check SOTG */ 
    1441    if($a->games > 0 && $b->games > 0) { 
    1442       if( ($a->spirit / $a->games) > ($b->spirit / $b->games)) { 
    1443          return -1; 
    1444       } else if( ($a->spirit / $a->games) < ($b->spirit / $b->games)) { 
    1445          return 1; 
    1446       } 
    1447    } 
    1448    return 0; 
    1449 } 
    1450  
    14511428?> 
  • trunk/leaguerunner/src/includes/common.inc

    r279 r306  
    296296 
    297297  $base_url = $BASE_URL; 
    298   $cleanURL = variable_get('clean_url', 1); 
     298  $cleanURL = variable_get('clean_url', 0); 
    299299 
    300300  if (empty($script)) {