forked from science-ation/science-ation
Add available in round1,round2 to the judge report
This commit is contained in:
parent
69eb9a2817
commit
8d8bcdad94
@ -201,7 +201,58 @@ function report_judges_team_members(&$report, $field, $text)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $ret;
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//$round_special_awards = array();
|
||||||
|
$report_judges_rounds = array();
|
||||||
|
function report_judges_load_rounds($year)
|
||||||
|
{
|
||||||
|
global $config, $report_judges_rounds;
|
||||||
|
if(count($report_judges_rounds)) return ;
|
||||||
|
|
||||||
|
$q = mysql_query("SELECT * FROM judges_timeslots WHERE round_id='0' AND `year`='$year'");
|
||||||
|
/* Loads judges_timeslots.id, .starttime, .endtime, .date, .name */
|
||||||
|
while($r = mysql_fetch_assoc($q)) {
|
||||||
|
$report_judges_rounds[] = $r;
|
||||||
|
|
||||||
|
if($r['type'] == 'divisional1') $report_judges_rounds['divisional1'] = $r;
|
||||||
|
if($r['type'] == 'divisional2') $report_judges_rounds['divisional2'] = $r;
|
||||||
|
}
|
||||||
|
// if($r['type'] == 'special') $round_special_awards[] = $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
function report_judges_time_availability(&$report, $field, $text)
|
||||||
|
{
|
||||||
|
global $config, $report_judges_rounds;
|
||||||
|
$year = $report['year'];
|
||||||
|
$users_id = $text;
|
||||||
|
|
||||||
|
report_judges_load_rounds($year);
|
||||||
|
|
||||||
|
switch($field) {
|
||||||
|
case 'available_in_divisional1':
|
||||||
|
$round = $report_judges_rounds['divisional1'];
|
||||||
|
break;
|
||||||
|
case 'available_in_divisional2':
|
||||||
|
$round = $report_judges_rounds['divisional2'];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
echo "Not implemented.";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$q = mysql_query("SELECT * FROM judges_availability WHERE users_id='$users_id'");
|
||||||
|
// echo mysql_error();
|
||||||
|
while(($r = mysql_fetch_assoc($q))) {
|
||||||
|
if($r['start'] <= $round['starttime']
|
||||||
|
&& $r['end'] >= $round['endtime']
|
||||||
|
&& $r['date'] == $round['date'] ) {
|
||||||
|
return 'Yes';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 'No';
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Components: languages, teams */
|
/* Components: languages, teams */
|
||||||
@ -527,6 +578,20 @@ $report_judges_fields = array(
|
|||||||
'exec_function' => 'report_judges_cat_pref',
|
'exec_function' => 'report_judges_cat_pref',
|
||||||
'components' => array('users_judge')),
|
'components' => array('users_judge')),
|
||||||
|
|
||||||
|
/* Time Availability */
|
||||||
|
'available_in_divisional1' => array(
|
||||||
|
'name' => 'Time Availability -- Available in Divisional Round 1 ',
|
||||||
|
'header' => 'R1',
|
||||||
|
'width' => 0.5,
|
||||||
|
'exec_function' => 'report_judges_time_availability',
|
||||||
|
'table' => 'users.id'),
|
||||||
|
'available_in_divisional2' => array(
|
||||||
|
'name' => 'Time Availability -- Available in Divisional Round 2 ',
|
||||||
|
'header' => 'R2',
|
||||||
|
'width' => 0.5,
|
||||||
|
'exec_function' => 'report_judges_time_availability',
|
||||||
|
'table' => 'users.id'),
|
||||||
|
|
||||||
/* Others */
|
/* Others */
|
||||||
|
|
||||||
'special_award_only' => array(
|
'special_award_only' => array(
|
||||||
|
Loading…
Reference in New Issue
Block a user