forked from science-ation/science-ation
- Fix the awards query
- Add prize amounts to the report editor - Add a column to compute the number of students who worked on a project to the report editor
This commit is contained in:
parent
8ef6f7ea45
commit
801e70cb0c
@ -158,6 +158,14 @@ $report_students_fields = array(
|
||||
'width' => 1.00,
|
||||
'table' => 'projects.language' ),
|
||||
|
||||
'numstudents' => array(
|
||||
'name' => 'Project -- Number of Students',
|
||||
'header' => 'Stu.',
|
||||
'width' => 0.5,
|
||||
'table' => 'COUNT(numstudents.id)',
|
||||
'components' => array('numstudents'),
|
||||
'group_by' => array('numstudents.id') ),
|
||||
|
||||
'address' => array(
|
||||
'name' => 'Student Address -- Street Address',
|
||||
'header' => 'Address',
|
||||
@ -309,7 +317,7 @@ $report_students_fields = array(
|
||||
'components' => array('awards')),
|
||||
|
||||
'pn_awards' => array(
|
||||
'name' => 'Project Num + Award (will be unique)',
|
||||
'name' => 'Award -- Project Num + Award Name (will be unique for each award)',
|
||||
'header' => 'Award Name',
|
||||
'width' => 4,
|
||||
'table' => "CONCAT(projects.projectnumber,' ', award_awards.name)",
|
||||
@ -323,6 +331,27 @@ $report_students_fields = array(
|
||||
'table' => 'award_prizes.prize',
|
||||
'components' => array('awards')),
|
||||
|
||||
'award_prize_cash' => array(
|
||||
'name' => 'Award -- Prize Cash Amount',
|
||||
'header' => 'Cash',
|
||||
'width' => 0.5,
|
||||
'table' => 'award_prizes.cash',
|
||||
'components' => array('awards')),
|
||||
|
||||
'award_prize_scholarship' => array(
|
||||
'name' => 'Award -- Prize Scholarship Amount',
|
||||
'header' => 'Scholarship',
|
||||
'width' => 0.75,
|
||||
'table' => 'award_prizes.scholarship',
|
||||
'components' => array('awards')),
|
||||
|
||||
'award_prize_value' => array(
|
||||
'name' => 'Award -- Prize Value Amount',
|
||||
'header' => 'Value',
|
||||
'width' => 0.5,
|
||||
'table' => 'award_prizes.value',
|
||||
'components' => array('awards')),
|
||||
|
||||
'award_prize_fullname' => array(
|
||||
'name' => 'Award -- Prize Name, Category, Division',
|
||||
'header' => 'Prize Name',
|
||||
@ -455,15 +484,23 @@ $report_students_fields = array(
|
||||
$awards_where = '';
|
||||
|
||||
if(in_array('awards', $components)) {
|
||||
/* This requires some extra gymnastics */
|
||||
$awards_join = "LEFT JOIN winners ON(winners.projects_id = projects.id),award_prizes,award_awards,award_types";
|
||||
$awards_where = " AND winners.awards_prizes_id=award_prizes.id
|
||||
AND award_prizes.award_awards_id=award_awards.id
|
||||
AND award_types.id=award_awards.award_types_id
|
||||
AND winners.year='$year'
|
||||
AND award_awards.year='$year'
|
||||
AND award_prizes.year='$year'
|
||||
AND award_types.year='$year' ";
|
||||
/* This requires some extra gymnastics and will duplicate
|
||||
* students/projects if they have won multiple awards */
|
||||
$awards_join = "LEFT JOIN winners ON winners.projects_id = projects.id
|
||||
LEFT JOIN award_prizes ON award_prizes.id = winners.awards_prizes_id
|
||||
LEFT JOIN award_awards ON award_awards.id = award_prizes.award_awards_id
|
||||
LEFT JOIN award_types ON award_types.id=award_awards.award_types_id";
|
||||
$awards_where = " AND winners.year='$year'
|
||||
AND award_awards.year='$year'
|
||||
AND award_prizes.year='$year'
|
||||
AND award_types.year='$year' ";
|
||||
}
|
||||
|
||||
if(in_array('numstudents', $components)) {
|
||||
/* This requires some extra gymnastics and will duplicate
|
||||
* students/projects if they have won multiple awards */
|
||||
$numstudents_join = "LEFT JOIN students AS numstudents ON students.registrations_id=numstudents.registrations_id";
|
||||
$numstudents_where = " AND numstudents.year='$year'";
|
||||
}
|
||||
|
||||
if(in_array('awards_nominations', $components)) {
|
||||
@ -507,7 +544,9 @@ $report_students_fields = array(
|
||||
LEFT JOIN projectcategories ON projectcategories.id=projects.projectcategories_id
|
||||
$emergencycontact_join
|
||||
$tour_join
|
||||
$awards_join
|
||||
$partner_join
|
||||
$numstudents_join
|
||||
WHERE
|
||||
students.year='$year'
|
||||
AND projects.year='$year'
|
||||
@ -517,6 +556,7 @@ $report_students_fields = array(
|
||||
AND (registrations.status='complete' OR registrations.status='paymentpending')
|
||||
$awards_where
|
||||
$tour_where
|
||||
$numstudents_where
|
||||
";
|
||||
|
||||
return $q;
|
||||
|
Loading…
Reference in New Issue
Block a user