If availability is disabled, dont fail loading judges

Fix the team languages array
Fix the timeslots checks for schedulerconfig (need round AND timeslots, not just a round)
This commit is contained in:
james 2010-01-18 16:24:34 +00:00
parent 7e6795fd0d
commit c67488d375
4 changed files with 26 additions and 19 deletions

View File

@ -51,6 +51,10 @@ function getJudgingTeams()
{
$u = user_load($mr->judges_id, false);
$judgelangs = join('/', $u['languages']);
foreach($u['languages'] AS $l) {
if(!in_array($l,$teamlangs))
$teamlangs[]=$l;
}
$teams[$lastteamid]['members'][]=array(
"id"=>$mr->judges_id,

View File

@ -466,17 +466,18 @@ foreach($judges as &$j) {
unset($judges[$j['id']]);
continue;
}
/* Load the judge time availability */
$q = mysql_query("SELECT * FROM judges_availability WHERE users_id='{$j['id']}' ORDER BY `start`");
if(mysql_num_rows($q) == 0) {
TRACE(" {$j['name']} hasn't selected any time availability, POTENTIAL BUG (they shouldn't be marked as complete).\n");
TRACE(" Ignoring this judge.\n");
unset($judges[$j['id']]);
continue;
}
while($r = mysql_fetch_assoc($q)) {
$j['availability'][] = $r;
if($config['judges_availability_enable']=="yes") {
/* Load the judge time availability */
$q = mysql_query("SELECT * FROM judges_availability WHERE users_id='{$j['id']}' ORDER BY `start`");
if(mysql_num_rows($q) == 0) {
TRACE(" {$j['name']} hasn't selected any time availability, POTENTIAL BUG (they shouldn't be marked as complete).\n");
TRACE(" Ignoring this judge.\n");
unset($judges[$j['id']]);
continue;
}
while($r = mysql_fetch_assoc($q)) {
$j['availability'][] = $r;
}
}
/* Load special award preferences */
@ -1310,7 +1311,7 @@ for($k=0; $k<$keys_count; $k++) {
print_r($jteams_ids);
*/
print("Jteams ids len=".count($jteams_ids));
print("\n");
print("n_timeslots=$n_timeslots\n");
set_percent(50 + ($k / $keys_count) * 50);

View File

@ -7,9 +7,13 @@ function judges_scheduler_check_timeslots()
$q=mysql_query("SELECT * FROM judges_timeslots WHERE ".
" year='".$config['FAIRYEAR']."'".
" AND `type`='divisional1'" );
$rows = mysql_num_rows($q);
return $rows;
if(mysql_num_rows($q)) {
$round=mysql_fetch_object($q);
$q=mysql_query("SELECT * FROM judges_timeslots WHERE round_id='$round->id' AND type='timeslot'");
return mysql_num_rows($q);
}
else
return 0;
}
function judges_scheduler_check_awards()

View File

@ -350,10 +350,8 @@ if( ($action=="edit" || $action=="assign" ) && $edit)
echo "<td width=\"200\">";
echo "<b>".$team['name']." (#".$team['num'].")</b><br />";
$memberlist="";
if(count($team['members']))
{
foreach($team['members'] AS $member)
{
if(count($team['members'])) {
foreach($team['members'] AS $member) {
echo "&nbsp;&nbsp;";
if($member['captain']=="yes")
echo "<i>";