diff options
author | Michael Tänzer <neo@nhng.de> | 2012-10-31 02:06:31 +0100 |
---|---|---|
committer | Michael Tänzer <neo@nhng.de> | 2012-10-31 02:06:31 +0100 |
commit | 848a171e8371dfa08fd2a880f6c4ddcdea8a8880 (patch) | |
tree | 52e14e23e3071b09169f13dde36d6212a1acbc9a | |
parent | cee352541de0779adff84eac4e7ae9cbd034f255 (diff) | |
download | cacert-devel-bug-1004.tar.gz cacert-devel-bug-1004.tar.xz cacert-devel-bug-1004.zip |
bug 1004: fix SQL syntaxbug-1004
Signed-off-by: Michael Tänzer <neo@nhng.de>
-rwxr-xr-x | scripts/cron/refresh_stats.php | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/scripts/cron/refresh_stats.php b/scripts/cron/refresh_stats.php index 1703665..2a3d2b5 100755 --- a/scripts/cron/refresh_stats.php +++ b/scripts/cron/refresh_stats.php @@ -120,23 +120,26 @@ function getDataFromLive() { $stats['users_1to49'] = number_format(tc( "select count(*) as `count` from ( - select 1 from `notary` group by `to` + select 1 from `notary` where `deleted` = 0 + group by `to` having sum(`points`) > 0 and sum(`points`) < 50 ) as `low_points`")); $stats['users_50to99'] = number_format(tc( "select count(*) as `count` from ( - select 1 from `notary` group by `to` + select 1 from `notary` where `deleted` = 0 + group by `to` having sum(`points`) >= 50 and sum(`points`) < 100 ) as `high_points`")); $stats['assurer_candidates'] = number_format(tc( "select count(*) as `count` from `users` where ( - select sum(`points`) from `notary` where `to`=`users`.`id` - where `deleted` = 0 + select sum(`points`) from `notary` + where `to`=`users`.`id` + and `deleted` = 0 ) >= 100 and not exists( select 1 from `cats_passed` as `cp`, `cats_variant` as `cv` @@ -149,8 +152,9 @@ function getDataFromLive() { $stats['aussurers_with_test'] = number_format(tc( "select count(*) as `count` from `users` where ( - select sum(`points`) from `notary` where `to`=`users`.`id` - where `deleted` = 0 + select sum(`points`) from `notary` + where `to`=`users`.`id` + and `deleted` = 0 ) >= 100 and exists( select 1 from `cats_passed` as `cp`, `cats_variant` as `cv` |