forked from science-ation/science-ation
Add two columns for all divisions the judge selected 5-expert for
This commit is contained in:
parent
34368908bc
commit
6261919878
@ -26,8 +26,60 @@
|
||||
* with a space */
|
||||
function report_judges_languages(&$report, $text)
|
||||
{
|
||||
$l = unserialize($text);
|
||||
return join(' ', $l);
|
||||
$l = unserialize($text);
|
||||
return join(' ', $l);
|
||||
}
|
||||
|
||||
$report_judges_divs = array();
|
||||
function report_judges_5_div(&$report, $text)
|
||||
{
|
||||
global $report_judges_divs;
|
||||
|
||||
/* Text is users_judge.div_prefs */
|
||||
$year = $report['year'];
|
||||
$divprefs = unserialize($text);
|
||||
|
||||
/* Load divisions, only once */
|
||||
if(count($report_judges_divs) == 0) {
|
||||
$q = mysql_query("SELECT * FROM projectdivisions WHERE year='$year'");
|
||||
while(($d = mysql_fetch_assoc($q))) {
|
||||
$report_judges_divs[$d['id']] = $d;
|
||||
}
|
||||
}
|
||||
|
||||
/* Find all 5-expert selections, and add them to the return */
|
||||
$ret = array();
|
||||
foreach($divprefs as $div_id=>$sel) {
|
||||
if($sel != 5) continue;
|
||||
$ret[] = $report_judges_divs[$div_id]['division_shortform'];
|
||||
}
|
||||
/* Join it all together with spaces */
|
||||
return join(' ', $ret);
|
||||
}
|
||||
function report_judges_5_div_long(&$report, $text)
|
||||
{
|
||||
global $report_judges_divs;
|
||||
|
||||
/* Text is users_judge.div_prefs */
|
||||
$year = $report['year'];
|
||||
$divprefs = unserialize($text);
|
||||
|
||||
/* Load divisions, only once */
|
||||
if(count($report_judges_divs) == 0) {
|
||||
$q = mysql_query("SELECT * FROM projectdivisions WHERE year='$year'");
|
||||
while(($d = mysql_fetch_assoc($q))) {
|
||||
$report_judges_divs[$d['id']] = $d;
|
||||
}
|
||||
}
|
||||
|
||||
/* Find all 5-expert selections, and add them to the return */
|
||||
$ret = array();
|
||||
foreach($divprefs as $div_id=>$sel) {
|
||||
if($sel != 5) continue;
|
||||
$ret[] = $report_judges_divs[$div_id]['division'];
|
||||
}
|
||||
/* Join it all together with spaces */
|
||||
return join(', ', $ret);
|
||||
}
|
||||
|
||||
|
||||
@ -161,6 +213,22 @@ $report_judges_fields = array(
|
||||
'table' => 'users_judge.highest_psd',
|
||||
'components' => array('users_judge')),
|
||||
|
||||
'div_prefs_5' => array(
|
||||
'name' => 'Judge -- Divisions Selected as 5-Expert (Shortform)',
|
||||
'header' => 'Expert Div',
|
||||
'width' => 1,
|
||||
'table' => 'users_judge.div_prefs',
|
||||
'exec_function' => 'report_judges_5_div',
|
||||
'components' => array('users_judge')),
|
||||
|
||||
'div_prefs_5_long' => array(
|
||||
'name' => 'Judge -- Divisions Selected as 5-Expert (Full division names)',
|
||||
'header' => 'Expert Div',
|
||||
'width' => 1.5,
|
||||
'table' => 'users_judge.div_prefs',
|
||||
'exec_function' => 'report_judges_5_div_long',
|
||||
'components' => array('users_judge')),
|
||||
|
||||
'typepref' => array(
|
||||
'name' => 'Judge -- Type Preference',
|
||||
'header' => 'Type Pref',
|
||||
|
Loading…
Reference in New Issue
Block a user