From c0f10ced4103b76d7fdb888fb5e4b0917fa5d6d7 Mon Sep 17 00:00:00 2001 From: Bruce Allen Date: Sun, 11 Sep 2005 08:09:39 +0000 Subject: [PATCH] Previously the only profiles with verification=1 were those with credit, so UOTD was selected from those. Now there are profiles of users with zero credit that have verification=1. So script that selects UOTD now does a table join to restrict profile searches to those of users with credit only. svn path=/trunk/boinc/; revision=7969 --- checkin_notes | 8 +++++++- html/inc/uotd.inc | 5 ++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/checkin_notes b/checkin_notes index acff1d14c2..8fe3f5ea9f 100755 --- a/checkin_notes +++ b/checkin_notes @@ -11635,11 +11635,17 @@ Bruce 10 Sept 2005 If admins have rejected it, user will see a message saying that they must replace their picture or no one but themselves can see it. - The only known side effect of this is that selection of UOTD is now - includes users with no credit. I will try to fix this. + done slightly differently by the uotd.inc functions. Previously the only + profiles with verification=1 were those with credit, so UOTD was + selected from those. Now there are profiles of users with zero credit + that have verification=1. So script that selects UOTD now does + a table join to restrict profile searches to those of users with + credit only. html/ inc/ profile.inc + uotd.inc ops/ profile_screen_form.php diff --git a/html/inc/uotd.inc b/html/inc/uotd.inc index 6c72b113d4..676ce05293 100644 --- a/html/inc/uotd.inc +++ b/html/inc/uotd.inc @@ -50,8 +50,7 @@ function build_uotd_page() { exit(); } } - // TODO: Verify that adding RAND() didn't screw this up. - $result = mysql_query("SELECT * FROM profile WHERE verification = 1 AND uotd_time IS NULL ORDER BY RAND()"); + $result = mysql_query("SELECT * FROM profile,user WHERE profile.userid=user.id AND total_credit>0 AND verification=1 AND uotd_time IS NULL ORDER BY RAND()"); // If the number of approved profiles dips below a threshold, // email the sys admin every time we pick a new one. @@ -70,7 +69,7 @@ function build_uotd_page() { // If all verified profiles have been selected as UOTD, // reshow the one that was shown least recently. // - $result = mysql_query("SELECT * FROM profile WHERE verification = 1 ORDER BY uotd_time ASC LIMIT 1"); + $result = mysql_query("SELECT * FROM profile,user WHERE profile.userid=user.id AND total_credit>0 AND verification=1 ORDER BY uotd_time ASC LIMIT 1"); } if (!$result || mysql_num_rows($result) == 0) {