From a4e5761788c97af11cc589c234e7c004ba5f15ea Mon Sep 17 00:00:00 2001 From: dave Date: Fri, 12 Mar 2010 05:53:03 +0000 Subject: [PATCH] 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. --- admin/user_list.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/admin/user_list.php b/admin/user_list.php index d670ba7e..9bc5a61a 100644 --- a/admin/user_list.php +++ b/admin/user_list.php @@ -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 ""; - $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 ""; echo "
"; - 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 "
".i18n("yes")."
"; $completeyes++; } else {