Copyright (C) 2011 Dennis Spanogle This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ ?> SFIAB Evaluations Calculate Scores Calculate Scores

"; echo "
"; echo "Click the button to Calculate and enter scores values"; echo "
"; echo ""; echo "
"; echo ""; echo "
"; if(!$_POST['action'] == "calc") { echo ""; echo ""; exit; } echo "
All Scores calculated and saved!
"; echo "
Development Note: This updates the score field in 'judges_teams_timeslots_projects_link' for every team/project with a 'complete' evaluation entry
"; echo " and updates the eval_score (current average) and eval_score_status fields in table eval_projects for every project for which an average score can be calculated.
"; echo "For test purposes (to be removed later) it lists just the project number for each project, then lists the scores details for the last project in the list.

"; // do all projects that qualify for judging (in the judges_teams_timeslots_projects_link table) $q = mysql_query("SELECT DISTINCT projects_id from judges_teams_timeslots_projects_link"); while($r=mysql_fetch_object($q)) { $ret_array = calc_scores($r->projects_id); // cal_scores is in eval_common.inc.php if($ret_array == 'error') { echo " error"; } else{ echo " ".$ret_array[project_num]; // put scores in 'judges_teams_timeslots_projects_link' for ($i=0;$i < $ret_array[num_teams]; $i++){ $team_id = $ret_array[team_scores][$i][team_id]; $score = $ret_array[team_scores][$i][team_score]; if (is_null($score)) {$score = "NULL";} $up = mysql_query("UPDATE judges_teams_timeslots_projects_link SET score = ".$score. " WHERE judges_teams_id = '".$team_id."' AND projects_id = '".$r->projects_id."' "); } // update eval_judges table $up = mysql_query("UPDATE eval_projects SET eval_score = '".$ret_array[eval_score]."', eval_score_status = '".$ret_array[eval_score_status]."' WHERE project_id = '".$r->projects_id."' "); } } echo "

"; // for debug - this just prints out the values in the last project if ($ret_array =="error"){ echo $ret_array; } else { for ($i=0;$i < $ret_array[num_teams]; $i++){ echo "team_id=".$ret_array[team_scores][$i][team_id]." team_num= ".$ret_array[team_scores][$i][team_num] ."project_num = ". $ret_array[team_scores][$i][proj_num] ." score =".$ret_array[team_scores][$i][team_score]. " status = ".$ret_array[team_scores][$i][team_status] ."
"; } echo "Project number ".$ret_array[project_num].": score= ".$ret_array[eval_score]." status = ".$ret_array[eval_score_status]."
"; } echo ""; echo ""; exit; ?>