forked from science-ation/science-ation
1) Properly handle "filterdivisionbycategory" checks for divisional awards
2) Properly handle cases where there's MORE than one award for a certain div/cat combo
This commit is contained in:
parent
b146a9c773
commit
7bbea6351a
@ -70,14 +70,14 @@ if($config['judge_scheduler_percent']=="-1")
|
|||||||
|
|
||||||
$missing_awards = judges_scheduler_check_awards();
|
$missing_awards = judges_scheduler_check_awards();
|
||||||
if(count($missing_awards) == 0) {
|
if(count($missing_awards) == 0) {
|
||||||
echo happy(i18n("There is a divisional award for each division, good"));
|
echo happy(i18n("There is a single divisional award for each division/category, good"));
|
||||||
} else {
|
} else {
|
||||||
echo "<br />The following awards are missing:<br /><ul>";
|
echo "<br />The following divisional awards problems were identified:<br /><ul>";
|
||||||
for($x=0; $x<count($missing_awards); $x++) {
|
for($x=0; $x<count($missing_awards); $x++) {
|
||||||
print($missing_awards[$x]."<br />");
|
print($missing_awards[$x]."<br />");
|
||||||
}
|
}
|
||||||
echo "</ul>";
|
echo "</ul>";
|
||||||
echo error(i18n("There are missing divisional awards"));
|
echo error(i18n("There needs to be exactly one award for each division/category"));
|
||||||
$ok = 0;
|
$ok = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,10 +27,28 @@ function judges_scheduler_check_awards()
|
|||||||
$dkeys = array_keys($div);
|
$dkeys = array_keys($div);
|
||||||
$ckeys = array_keys($cat);
|
$ckeys = array_keys($cat);
|
||||||
|
|
||||||
|
if($config['filterdivisionbycategory']=="yes") {
|
||||||
|
$q=mysql_query("SELECT * FROM projectcategoriesdivisions_link WHERE year='".$config['FAIRYEAR']."' ORDER BY projectdivisions_id,projectcategories_id");
|
||||||
|
$divcat=array();
|
||||||
|
while($r=mysql_fetch_object($q)) {
|
||||||
|
$divcat[]=array("c"=>$r->projectcategories_id,"d"=>$r->projectdivisions_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$divcat=array();
|
||||||
|
foreach($dkeys AS $d) {
|
||||||
|
foreach($ckeys AS $c) {
|
||||||
|
$divcat[]=array("c"=>$c,"d"=>$d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$missing_awards = array();
|
$missing_awards = array();
|
||||||
foreach($dkeys as $d) {
|
foreach($divcat AS $dc) {
|
||||||
reset($ckeys);
|
$d=$dc['d'];
|
||||||
foreach ($ckeys as $c) {
|
$c=$dc['c'];
|
||||||
$q=mysql_query("SELECT award_awards.id FROM
|
$q=mysql_query("SELECT award_awards.id FROM
|
||||||
award_awards,
|
award_awards,
|
||||||
award_awards_projectcategories,
|
award_awards_projectcategories,
|
||||||
@ -47,12 +65,10 @@ function judges_scheduler_check_awards()
|
|||||||
");
|
");
|
||||||
echo mysql_error();
|
echo mysql_error();
|
||||||
if(mysql_num_rows($q)!=1) {
|
if(mysql_num_rows($q)!=1) {
|
||||||
$missing_awards[] = "{$cat[$c]} - {$div[$d]}";
|
$missing_awards[] = "{$cat[$c]} - {$div[$d]} (".i18n("%1 found",array(mysql_num_rows($q))).")";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $missing_awards;
|
return $missing_awards;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user