forked from science-ation/science-ation
- 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:
parent
f98b3b70b2
commit
f39ffeced4
@ -253,7 +253,7 @@ function judge_mark_for_round($j, $r)
|
||||
* modify this availabilty so it doesn't overlap */
|
||||
/* This may cause $a['start'] == $a['end'], that's ok */
|
||||
$a['end'] = $r['starttime'];
|
||||
TRACE("adjust starttime\n");
|
||||
// TRACE("adjust starttime\n");
|
||||
}
|
||||
|
||||
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 */
|
||||
/* This may cause $a['start'] == $a['end'], that's ok */
|
||||
$a['start'] = $r['endtime'];
|
||||
TRACE("adjust starttime\n");
|
||||
// TRACE("adjust endtime\n");
|
||||
}
|
||||
|
||||
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'],
|
||||
'cat' => $d['cat'],
|
||||
'lang' => $d['lang']);
|
||||
$jdiv[$jdiv_id]['award_ids'] = array();
|
||||
$count++;
|
||||
}
|
||||
TRACE(" ($count projects)\n");
|
||||
@ -508,6 +509,10 @@ foreach($judges as &$j) {
|
||||
* $j, which is a copy */
|
||||
$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 {
|
||||
$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']}')");
|
||||
/* 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,37 +783,56 @@ for($y=0; $y<count($ids); $y++) {
|
||||
*
|
||||
***************************************************************************/
|
||||
echo "Finding round2 carry-over judges:\n";
|
||||
$team_id = judge_team_create(next_judges_teams_number(), 'Round2 Divisional');
|
||||
|
||||
for($x=1;$x<count($jteam); $x++) {
|
||||
$t =& $jteam[$x];
|
||||
$rep_id = NULL;
|
||||
$chair_rep = false;
|
||||
foreach($jdiv as $jdiv_id=>$jd) {
|
||||
|
||||
/* 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;
|
||||
$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++) {
|
||||
$t =& $jteam[$x];
|
||||
|
||||
if($t['jdiv_id'] != $jdiv_id) continue;
|
||||
|
||||
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']}')");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
Loading…
Reference in New Issue
Block a user