Properly count the number of judges in each language to check if we have enough

This commit is contained in:
james 2010-01-08 20:25:40 +00:00
parent d8ba3da289
commit 591f46b29d

View File

@ -186,13 +186,15 @@ function judges_scheduler_check_judges()
$ok=false; $ok=false;
} }
foreach($config['languages'] AS $lkey=>$lname) { foreach($config['languages'] AS $lkey=>$lname) {
$jq=mysql_query("SELECT COUNT(judges.id) AS num FROM judges,judges_years,judges_languages WHERE complete='yes' AND deleted='no' AND judges_years.year='{$config['FAIRYEAR']}' AND judges_years.judges_id=judges.id AND judges_languages.languages_lang='$lkey' AND judges_languages.judges_id=judges.id"); $lcount=0;
echo mysql_error(); foreach($judges AS $j) {
$jr=mysql_fetch_object($jq); foreach($j['languages'] AS $jlang) {
$currentjudges=$jr->num; if($jlang==$lkey) $lcount++;
}
}
$currentjudges=$lcount;
echo "&nbsp;&nbsp;<b>".i18n("Current number of registered judges that can judge in %1: %2",array($lname,$currentjudges))."</b>"; echo "&nbsp;&nbsp;<b>".i18n("Current number of registered judges that can judge in %1: %2",array($lname,$currentjudges))."</b>";
echo "<br />"; echo "<br />";
if($currentjudges<$minjudges[$lkey]) { if($currentjudges<$minjudges[$lkey]) {
@ -202,8 +204,6 @@ function judges_scheduler_check_judges()
} }
if(!$ok) { if(!$ok) {
echo "&nbsp;&nbsp;"; echo "&nbsp;&nbsp;";
echo "<a href=\"judges_schedulerconfig.php\">".i18n("Update Scheduler Configuration")."</a> (".i18n("or get more judges!").")"; echo "<a href=\"judges_schedulerconfig.php\">".i18n("Update Scheduler Configuration")."</a> (".i18n("or get more judges!").")";