forked from science-ation/science-ation
Update the judges automatic scheduler to honour filtering categories by divisions, so we only get teams for cat/div combos that we actually need
This commit is contained in:
parent
cbfd619af7
commit
d5fd002820
@ -327,6 +327,15 @@ $q=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR'
|
||||
while($r=mysql_fetch_object($q))
|
||||
$cat[$r->id]=$r->category;
|
||||
|
||||
|
||||
if($config['filterdivisionbycategory']=="yes")
|
||||
{
|
||||
$q=mysql_query("SELECT * FROM projectcategoriesdivisions_link WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
|
||||
while($r=mysql_fetch_object($q))
|
||||
$catdiv[$r->projectcategories_id][]=$r->projectdivisions_id;
|
||||
}
|
||||
|
||||
|
||||
$langr = array();
|
||||
$q=mysql_query("SELECT * FROM languages WHERE active='Y'");
|
||||
while($r=mysql_fetch_object($q))
|
||||
@ -368,6 +377,12 @@ foreach($div AS $d_id=>$d_val)
|
||||
{
|
||||
foreach($cat AS $c_id=>$c_val)
|
||||
{
|
||||
//only make the teams for the ones that are needed
|
||||
if($config['filterdivisionbycategory']=="yes")
|
||||
{
|
||||
if(!in_array($d_id,$catdiv[$c_id]))
|
||||
continue;
|
||||
}
|
||||
foreach($langr AS $l_id) {
|
||||
$num = count($jdivisions[$d_id][$c_id][$l_id]);
|
||||
|
||||
|
@ -22,7 +22,11 @@ function checkPrerequisites()
|
||||
echo "<h3>$catr->category</h3>";
|
||||
echo "<table>";
|
||||
echo "<tr><th>Division</th><th>Projects</th><th>Teams</th></tr>";
|
||||
$divq=mysql_query("SELECT * FROM projectdivisions WHERE year='{$config['FAIRYEAR']}' ORDER BY id");
|
||||
if($config['filterdivisionbycategory']=="yes")
|
||||
$divq=mysql_query("SELECT projectdivisions.* FROM projectdivisions,projectcategoriesdivisions_link WHERE projectdivisions.year='{$config['FAIRYEAR']}' AND projectcategoriesdivisions_link.projectcategories_id='$catr->id' AND projectcategoriesdivisions_link.projectdivisions_id=projectdivisions.id AND projectcategoriesdivisions_link.year='".$config['FAIRYEAR']."' ORDER BY id");
|
||||
else
|
||||
$divq=mysql_query("SELECT * FROM projectdivisions WHERE year='{$config['FAIRYEAR']}' ORDER BY id");
|
||||
echo mysql_error();
|
||||
while($divr=mysql_fetch_object($divq))
|
||||
{
|
||||
$langq=mysql_query("SELECT * FROM languages WHERE active='Y'");
|
||||
@ -82,6 +86,12 @@ function checkPrerequisites()
|
||||
while($r=mysql_fetch_object($q))
|
||||
$cat[$r->id]=$r->category;
|
||||
|
||||
if($config['filterdivisionbycategory']=="yes")
|
||||
{
|
||||
$q=mysql_query("SELECT * FROM projectcategoriesdivisions_link WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
|
||||
while($r=mysql_fetch_object($q))
|
||||
$catdiv[$r->projectcategories_id][]=$r->projectdivisions_id;
|
||||
}
|
||||
$foundawards="";
|
||||
$notfoundawards="";
|
||||
$foundteams="";
|
||||
@ -89,6 +99,11 @@ function checkPrerequisites()
|
||||
{
|
||||
foreach($cat AS $c_id=>$c_category)
|
||||
{
|
||||
if($config['filterdivisionbycategory']=="yes")
|
||||
{
|
||||
if(!in_array($d_id,$catdiv[$c_id]))
|
||||
continue;
|
||||
}
|
||||
$q=mysql_query("SELECT award_awards.id FROM
|
||||
award_awards,
|
||||
award_awards_projectcategories,
|
||||
|
Loading…
Reference in New Issue
Block a user