forked from science-ation/science-ation
- Fixup the judge reports for the new user system
This commit is contained in:
parent
3d1483975a
commit
f83a04ab04
@ -21,6 +21,17 @@
|
|||||||
Boston, MA 02111-1307, USA.
|
Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* Take the language array in users_judge, unserialize it, and join it
|
||||||
|
* with a space */
|
||||||
|
function report_judges_languages(&$report, $text)
|
||||||
|
{
|
||||||
|
$l = unserialize($text);
|
||||||
|
return join(' ', $l);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Components: languages, teams */
|
/* Components: languages, teams */
|
||||||
|
|
||||||
$report_judges_fields = array(
|
$report_judges_fields = array(
|
||||||
@ -99,19 +110,20 @@ $report_judges_fields = array(
|
|||||||
'table' => 'users.organization'),
|
'table' => 'users.organization'),
|
||||||
|
|
||||||
'languages' => array(
|
'languages' => array(
|
||||||
'name' => 'Judge -- Languages (REQUIRES MySQL 5.0)',
|
'name' => 'Judge -- Languages',
|
||||||
'header' => 'Lang',
|
'header' => 'Lang',
|
||||||
'width' => 0.75,
|
'width' => 0.75,
|
||||||
'table' => "GROUP_CONCAT(judges_languages.languages_lang ORDER BY judges_languages.languages_lang SEPARATOR ' ')",
|
'table' => 'users_judge.languages',
|
||||||
'group_by' => array('judges.id'),
|
'exec_function' => 'report_judges_languages',
|
||||||
'components' => array('languages')),
|
'components' => array('users_judge')),
|
||||||
|
|
||||||
'complete' => array(
|
'complete' => array(
|
||||||
'name' => 'Judge -- Registration Complete',
|
'name' => 'Judge -- Registration Complete',
|
||||||
'header' => 'Cmpl',
|
'header' => 'Cmpl',
|
||||||
'width' => 0.4,
|
'width' => 0.4,
|
||||||
'table' => 'judges.complete',
|
'table' => 'users_judge.judge_complete',
|
||||||
'value_map' => array ('no' => 'No', 'yes' => 'Yes')),
|
'value_map' => array ('no' => 'No', 'yes' => 'Yes'),
|
||||||
|
'components' => array('users_judge')),
|
||||||
|
|
||||||
'year' => array(
|
'year' => array(
|
||||||
'name' => 'Judge -- Year',
|
'name' => 'Judge -- Year',
|
||||||
@ -174,7 +186,7 @@ $report_judges_fields = array(
|
|||||||
'header' => 'Student(s)',
|
'header' => 'Student(s)',
|
||||||
'width' => 3.0,
|
'width' => 3.0,
|
||||||
'table' => "GROUP_CONCAT(students.firstname, ' ', students.lastname ORDER BY students.lastname SEPARATOR ', ')",
|
'table' => "GROUP_CONCAT(students.firstname, ' ', students.lastname ORDER BY students.lastname SEPARATOR ', ')",
|
||||||
'group_by' => array('judges.id','judges_teams_timeslots_projects_link.id'),
|
'group_by' => array('users.id','judges_teams_timeslots_projects_link.id'),
|
||||||
'components' => array('teams', 'projects', 'students')),
|
'components' => array('teams', 'projects', 'students')),
|
||||||
|
|
||||||
'project_timeslot_start' => array(
|
'project_timeslot_start' => array(
|
||||||
@ -220,17 +232,14 @@ $report_judges_fields = array(
|
|||||||
$fields = $report_judges_fields;
|
$fields = $report_judges_fields;
|
||||||
$year = $report['year'];
|
$year = $report['year'];
|
||||||
|
|
||||||
/* For now languages is a module, doesn't duplicate rows, but it requries mysql 5 for
|
if(in_array('users_judge', $components)) {
|
||||||
* a GROUP_CONCAT */
|
$uj_from = 'LEFT JOIN users_judge ON users_judge.users_id=users.id';
|
||||||
$languages_from = '';
|
|
||||||
if(in_array('languages', $components)) {
|
|
||||||
$languages_from = 'LEFT JOIN judges_languages ON judges_languages.judges_id=judges.id';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$teams_from = '';
|
$teams_from = '';
|
||||||
$teams_where = '';
|
$teams_where = '';
|
||||||
if(in_array('teams', $components)) {
|
if(in_array('teams', $components)) {
|
||||||
$teams_from = "LEFT JOIN judges_teams_link ON judges_teams_link.judges_id=judges.id
|
$teams_from = "LEFT JOIN judges_teams_link ON judges_teams_link.users_id=users.id
|
||||||
LEFT JOIN judges_teams ON judges_teams.id=judges_teams_link.judges_teams_id";
|
LEFT JOIN judges_teams ON judges_teams.id=judges_teams_link.judges_teams_id";
|
||||||
$teams_where = "AND judges_teams_link.year='$year'
|
$teams_where = "AND judges_teams_link.year='$year'
|
||||||
AND judges_teams.year='$year'";
|
AND judges_teams.year='$year'";
|
||||||
@ -255,22 +264,21 @@ $report_judges_fields = array(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Search the report for a filter based on judge year */
|
/* Search the report for a filter based on judge year */
|
||||||
$year_where = "judges_years.year='$year'";
|
$year_where = "AND users.year='$year'";
|
||||||
foreach($report['filter'] as $d) {
|
foreach($report['filter'] as $d) {
|
||||||
if($d['field'] == 'year') {
|
if($d['field'] == 'year') {
|
||||||
/* Don't interally filter on year, we'll do it
|
/* Don't interally filter on year, we'll do it externally */
|
||||||
* externally */
|
$year_where = '';
|
||||||
$year_where = '1';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$q = " FROM users
|
$q = " FROM users
|
||||||
LEFT JOIN judges_years ON judges_years.judges_id = judges.id
|
|
||||||
$languages_from
|
|
||||||
$teams_from
|
$teams_from
|
||||||
$projects_from
|
$projects_from
|
||||||
$students_from
|
$students_from
|
||||||
|
$uj_from
|
||||||
WHERE
|
WHERE
|
||||||
|
users.types LIKE '%judge%'
|
||||||
$year_where
|
$year_where
|
||||||
$teams_where
|
$teams_where
|
||||||
$projects_where
|
$projects_where
|
||||||
|
Loading…
x
Reference in New Issue
Block a user