diff --git a/admin/judges_teams_members.php b/admin/judges_teams_members.php index 1111018..125e015 100644 --- a/admin/judges_teams_members.php +++ b/admin/judges_teams_members.php @@ -236,79 +236,33 @@ function switchjudgeinfo() echo ""; -/* - //mysql 4.0 does not support subqueries - it is supported as of mysql 4.1 - //this means we cant use NOT IN (SELECT..) so, we will have to workaround this - //at least for now. - - $querystr="SELECT - judges.id, - judges.firstname, - judges.lastname - FROM - judges, - judges_years - WHERE - judges_years.year='".$config['FAIRYEAR']."' AND - judges.id=judges_years.users_id AND - judges.id NOT IN (SELECT users_id AS id FROM judges_teams_link WHERE judges_teams_link.year='".$config['FAIRYEAR']."') - ORDER BY - lastname, - firstname"; -*/ - /* Load all the judges (judge_complete=yes, deleted=no, year=fairyear) */ $judgelist = judges_load_all(); - /* Load all the team links */ - - - -/* $querystr="SELECT - judges.id, - judges.firstname, - judges.lastname - FROM - judges, - judges_years - WHERE - judges_years.year='".$config['FAIRYEAR']."' AND - judges.id=judges_years.users_id AND - judges.complete='yes' - ORDER BY - lastname, - firstname"; - $q=mysql_query($querystr); - $judgelist=array(); - while($r=mysql_fetch_object($q)) { - $judgelist[$r->id]=$r; + /* Load all the teams */ + $teams = array(); + $q = mysql_query("SELECT * FROM judges_teams WHERE year='{$config['FAIRYEAR']}'"); + while($i = mysql_fetch_assoc($q)) { + $teams[$i['id']] = $i; } - */ + + /* And the links */ + $links = array(); + $q = mysql_query("SELECT * FROM judges_teams_link WHERE year='{$config['FAIRYEAR']}'"); + while($i = mysql_fetch_assoc($q)) { + $judgelist[$i['users_id']]['teams_links'][] = $i; + } + if($_SESSION['viewstate']['judges_teams_list_show']=='unassigned') { - $querystr="SELECT - judges.id, - judges.firstname, - judges.lastname - FROM - judges, - judges_teams_link, - judges_years - WHERE - judges_years.year='".$config['FAIRYEAR']."' - AND judges_teams_link.year='".$config['FAIRYEAR']."' - AND judges.id=judges_years.users_id - AND judges.id=judges_teams_link.users_id - AND judges.complete='yes' - ORDER BY - lastname, - firstname"; - $q=mysql_query($querystr); - while($r=mysql_fetch_object($q)) { - //remove anyone we find here from the list of all judges - unset($judgelist[$r->id]); + /* Remove all judges that have a link */ + foreach($judgelist as $j) { + if(count($j['teams_links']) > 0) { + unset($judgelist[$j['id']]); + } } } + echo "
"; echo i18n("Listing %1 judges",array(count($judgelist))); echo "
";