- Create one round2 team for each jdiv, instead of just one big team

- Fix the judge cost funciton a bit.
This commit is contained in:
dave 2009-03-29 05:43:22 +00:00
parent f98b3b70b2
commit f39ffeced4

View File

@ -253,7 +253,7 @@ function judge_mark_for_round($j, $r)
* modify this availabilty so it doesn't overlap */ * modify this availabilty so it doesn't overlap */
/* This may cause $a['start'] == $a['end'], that's ok */ /* This may cause $a['start'] == $a['end'], that's ok */
$a['end'] = $r['starttime']; $a['end'] = $r['starttime'];
TRACE("adjust starttime\n"); // TRACE("adjust starttime\n");
} }
if($r['endtime'] >= $a['start'] && $r['endtime'] <= $a['end']) { if($r['endtime'] >= $a['start'] && $r['endtime'] <= $a['end']) {
@ -261,7 +261,7 @@ function judge_mark_for_round($j, $r)
* modify this availabilty so it doesn't overlap */ * modify this availabilty so it doesn't overlap */
/* This may cause $a['start'] == $a['end'], that's ok */ /* This may cause $a['start'] == $a['end'], that's ok */
$a['start'] = $r['endtime']; $a['start'] = $r['endtime'];
TRACE("adjust starttime\n"); // TRACE("adjust endtime\n");
} }
if($a['start'] >= $a['end']) { if($a['start'] >= $a['end']) {
@ -270,7 +270,7 @@ function judge_mark_for_round($j, $r)
} }
} }
print_r($ju['availability']); // print_r($ju['availability']);
} }
@ -389,6 +389,7 @@ foreach($keys as $jdiv_id) {
'div' => $d['div'], 'div' => $d['div'],
'cat' => $d['cat'], 'cat' => $d['cat'],
'lang' => $d['lang']); 'lang' => $d['lang']);
$jdiv[$jdiv_id]['award_ids'] = array();
$count++; $count++;
} }
TRACE(" ($count projects)\n"); TRACE(" ($count projects)\n");
@ -508,6 +509,10 @@ foreach($judges as &$j) {
* $j, which is a copy */ * $j, which is a copy */
$j['special_awards'][] = $r->id; $j['special_awards'][] = $r->id;
} }
/* optimization, so the div1 cost function can try to find one
* round2 judge per team */
$j['available_for_divisional2'] == judge_available_for_round($j, $round_divisional2);
} }
@ -755,6 +760,10 @@ for($x=1;$x<count($jteam); $x++) {
} else { } else {
$r=mysql_fetch_object($q); $r=mysql_fetch_object($q);
mysql_query("INSERT INTO judges_teams_awards_link (award_awards_id,judges_teams_id,year) VALUES ('$r->id','$team_id','{$config['FAIRYEAR']}')"); mysql_query("INSERT INTO judges_teams_awards_link (award_awards_id,judges_teams_id,year) VALUES ('$r->id','$team_id','{$config['FAIRYEAR']}')");
/* Add the award ID to the jdiv, if it's not already there */
if(!in_array($r->id, $jdiv[$t['jdiv_id']]['award_ids'])) {
$jdiv[$t['jdiv_id']]['award_ids'][] = $r->id;
}
} }
} }
@ -774,10 +783,22 @@ for($y=0; $y<count($ids); $y++) {
* *
***************************************************************************/ ***************************************************************************/
echo "Finding round2 carry-over judges:\n"; echo "Finding round2 carry-over judges:\n";
$team_id = judge_team_create(next_judges_teams_number(), 'Round2 Divisional');
foreach($jdiv as $jdiv_id=>$jd) {
$num = next_judges_teams_number();
$team_id = judge_team_create($num, 'Round 2 Divisional '.$jdiv_id);
TRACE("Created Round2 team id $team_id\n");
/* Find all the jteams in this jdiv */
for($x=1;$x<count($jteam); $x++) { for($x=1;$x<count($jteam); $x++) {
$t =& $jteam[$x]; $t =& $jteam[$x];
if($t['jdiv_id'] != $jdiv_id) continue;
TRACE(" Round1 team #{$t['num']} ({$t['id']})\n");
$rep_id = NULL; $rep_id = NULL;
$chair_rep = false; $chair_rep = false;
@ -807,6 +828,13 @@ for($x=1;$x<count($jteam); $x++) {
} }
} }
/* 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']}')");
}
}
/**************************************************************************** /****************************************************************************
* Special Awards * Special Awards
* - Find ALL special award rounds * - Find ALL special award rounds