Skip round2 judge scheduling if no round2 timeslots are defined.

This commit is contained in:
dave 2010-02-17 18:24:07 +00:00
parent 4c79d7482d
commit 147655171c

View File

@ -789,55 +789,61 @@ for($y=0; $y<count($ids); $y++) {
* - No annealing required
*
***************************************************************************/
echo "Finding round2 carry-over judges:\n";
foreach($jdiv as $jdiv_id=>$jd) {
if($round_divisional2 == NULL) {
echo "No Round 2 Divisional defined, skipping.\n";
} else {
$num = next_judges_teams_number();
$team_id = judge_team_create($num, 'Round 2 Divisional '.$jdiv_id);
echo "Finding round2 carry-over judges:\n";
TRACE("Created Round2 team id $team_id\n");
foreach($jdiv as $jdiv_id=>$jd) {
/* Find all the jteams in this jdiv */
for($x=1;$x<count($jteam); $x++) {
$t =& $jteam[$x];
$num = next_judges_teams_number();
$team_id = judge_team_create($num, 'Round 2 Divisional '.$jdiv_id);
if($t['jdiv_id'] != $jdiv_id) continue;
TRACE("Created Round2 team id $team_id\n");
TRACE(" Round1 team #{$t['num']} ({$t['id']})\n");
/* Find all the jteams in this jdiv */
for($x=1;$x<count($jteam); $x++) {
$t =& $jteam[$x];
$rep_id = NULL;
$chair_rep = false;
if($t['jdiv_id'] != $jdiv_id) continue;
/* We would like the willing_chair to be the person that sticks around
* for round2, but if that's not possible, prefer anyone on the jteam be
* around for round2 */
foreach($t['judge_ids'] as $judge_id) {
$j =& $judges[$judge_id];
if(judge_available_for_round($j, $round_divisional2)) {
if($j['willing_chair'] == true) {
$rep_id = $judge_id;
$chair_rep = true;
break;
} else if($chair_rep == false) {
$rep_id = $judge_id;
TRACE(" Round1 team #{$t['num']} ({$t['id']})\n");
$rep_id = NULL;
$chair_rep = false;
/* We would like the willing_chair to be the person that sticks around
* for round2, but if that's not possible, prefer anyone on the jteam be
* around for round2 */
foreach($t['judge_ids'] as $judge_id) {
$j =& $judges[$judge_id];
if(judge_available_for_round($j, $round_divisional2)) {
if($j['willing_chair'] == true) {
$rep_id = $judge_id;
$chair_rep = true;
break;
} else if($chair_rep == false) {
$rep_id = $judge_id;
}
}
}
if($rep_id != NULL) {
pr_judge($t, $rep_id);
/* Mark this judge as used in this round */
judge_mark_for_round($judges[$rep_id], $round_divisional2);
/* Write it to the DB */
judge_team_add_judge($team_id, $rep_id);
} else {
echo "WARNING: Team $x has no carryover judge.\n";
}
}
if($rep_id != NULL) {
pr_judge($t, $rep_id);
/* Mark this judge as used in this round */
judge_mark_for_round($judges[$rep_id], $round_divisional2);
/* Write it to the DB */
judge_team_add_judge($team_id, $rep_id);
} else {
echo "WARNING: Team $x has no carryover judge.\n";
}
}
/* Assign all the awards in this jdiv */
foreach($jd['award_ids'] as $aid) {
mysql_query("INSERT INTO judges_teams_awards_link (award_awards_id,judges_teams_id,year) VALUES ('$aid','$team_id','{$config['FAIRYEAR']}')");
/* Assign all the awards in this jdiv */
foreach($jd['award_ids'] as $aid) {
mysql_query("INSERT INTO judges_teams_awards_link (award_awards_id,judges_teams_id,year) VALUES ('$aid','$team_id','{$config['FAIRYEAR']}')");
}
}
}