forked from science-ation/science-ation
Remove the sub-query from the user list, significantly speeds it up.
And, dont' show complete status for user types that don't need it.
This commit is contained in:
parent
af4b50ace0
commit
a4e5761788
@ -167,7 +167,7 @@ function neweditor()
|
||||
/* Grab a list of users */
|
||||
$w = array();
|
||||
foreach($show_types as $t) {
|
||||
$w [] = "u1.types LIKE '%$t%'";
|
||||
$w [] = "users.types LIKE '%$t%'";
|
||||
}
|
||||
$where_types = "AND (".join(" OR ", $w).")";
|
||||
|
||||
@ -179,23 +179,21 @@ function neweditor()
|
||||
}
|
||||
|
||||
if($show_year == 'current')
|
||||
$having_year = "AND u1.year={$config['FAIRYEAR']}";
|
||||
$having_year = "AND users.year={$config['FAIRYEAR']}";
|
||||
|
||||
echo "<table class=\"tableview\">";
|
||||
|
||||
$querystr="SELECT
|
||||
*
|
||||
$querystr="SELECT *,MAX(users.year) as MAXYEAR
|
||||
FROM
|
||||
users u1
|
||||
LEFT JOIN `users_committee` ON `users_committee`.`users_id`=`u1`.`id`
|
||||
LEFT JOIN `users_judge` ON `users_judge`.`users_id`=`u1`.`id`
|
||||
LEFT JOIN `users_volunteer` ON `users_volunteer`.`users_id`=`u1`.`id`
|
||||
LEFT JOIN `users_fair` ON `users_fair`.`users_id`=`u1`.`id`
|
||||
LEFT JOIN `users_sponsor` ON `users_sponsor`.`users_id`=`u1`.`id`
|
||||
WHERE u1.year=( SELECT MAX(`year`) FROM users u2 WHERE u1.uid=u2.uid )
|
||||
GROUP BY uid
|
||||
users
|
||||
LEFT JOIN `users_committee` ON `users_committee`.`users_id`=`users`.`id`
|
||||
LEFT JOIN `users_judge` ON `users_judge`.`users_id`=`users`.`id`
|
||||
LEFT JOIN `users_volunteer` ON `users_volunteer`.`users_id`=`users`.`id`
|
||||
LEFT JOIN `users_fair` ON `users_fair`.`users_id`=`users`.`id`
|
||||
LEFT JOIN `users_sponsor` ON `users_sponsor`.`users_id`=`users`.`id`
|
||||
GROUP BY users.uid
|
||||
HAVING
|
||||
u1.deleted='no'
|
||||
users.deleted='no'
|
||||
$having_year
|
||||
$where_types
|
||||
$where_complete
|
||||
@ -266,7 +264,9 @@ function neweditor()
|
||||
echo "</td>";
|
||||
|
||||
echo "<td>";
|
||||
if($r["{$t}_complete"] == 'yes') {
|
||||
if(in_array($t, array('parent','committee','alumni','mentor','fair'))) {
|
||||
/* Do nothing, there's nothign to complete */
|
||||
} else if($r["{$t}_complete"] == 'yes') {
|
||||
echo "<div class=\"happy\" align=\"center\">".i18n("yes")."</div>";
|
||||
$completeyes++;
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user