From 84c058819acda629c4d3f88350d0cb5f3f24fd38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20Fr=C3=B6hlich?= Date: Tue, 16 Aug 2011 23:53:27 +0200 Subject: Patches for bugs noticed by Hans. --- includes/wot.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'includes') diff --git a/includes/wot.inc.php b/includes/wot.inc.php index ce35ed6..ff9a0a3 100644 --- a/includes/wot.inc.php +++ b/includes/wot.inc.php @@ -412,7 +412,7 @@ else { $sum_points_countable = $sum_points; - $remark_points = " "; + $remark_points = " "; } if ($sum_experience > $max_experience) { @@ -439,7 +439,7 @@ if ($sum_points_countable < $max_points) { if ($sum_experience_countable != 0) - $remark_experience = $points_on_hold_txt;_("Points on hold due to less assurance points"); + $remark_experience = _("Points on hold due to less assurance points"); $sum_experience_countable = 0; if ($sum_experience_other_countable != 0) $remark_experience_other = _("Points on hold due to less assurance points"); -- cgit v1.2.1 From 443cafa2003738f9b2d34fdb1cad38528943fc46 Mon Sep 17 00:00:00 2001 From: dirk Date: Wed, 17 Aug 2011 01:03:19 +0200 Subject: modified top assurer/assuree list, missing ;, wrong ; and changed CATS behavior --- includes/wot.inc.php | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'includes') diff --git a/includes/wot.inc.php b/includes/wot.inc.php index e8b0448..d7c4b13 100644 --- a/includes/wot.inc.php +++ b/includes/wot.inc.php @@ -35,7 +35,7 @@ function get_number_of_assurances ($userid) { $res = query_init ("SELECT `users`. *, count(*) AS `list` FROM `users`, `notary` - WHERE `users`.`id` = `notary`.`from` AND `notary`.`from` != `notary`.`to` AND `from`='".intval($userid)."' + WHERE `users`.`id` = `notary`.`from` AND `notary`.`method` = 'Face to Face Meeting' AND `from`='".intval($userid)."' GROUP BY `notary`.`from`"); $row = query_getnextrow($res); @@ -45,7 +45,7 @@ function get_number_of_assurees ($userid) { $res = query_init ("SELECT `users`. *, count(*) AS `list` FROM `users`, `notary` - WHERE `users`.`id` = `notary`.`to` AND `notary`.`from` != `notary`.`to` AND `to`='".intval($userid)."' + WHERE `users`.`id` = `notary`.`to` AND `notary`.`method` = 'Face to Face Meeting' AND `to`='".intval($userid)."' GROUP BY `notary`.`to`"); $row = query_getnextrow($res); @@ -56,6 +56,7 @@ { $res = query_init ("SELECT count(*) AS `list` FROM `users` inner join `notary` on `users`.`id` = `notary`.`from` + WHERE `notary`.`method` = 'Face to Face Meeting' GROUP BY `notary`.`from` HAVING count(*) > '".intval($no_of_assurances)."'"); return intval(query_get_number_of_rows($res)+1); } @@ -64,6 +65,7 @@ { $res = query_init ("SELECT count(*) AS `list` FROM `users` inner join `notary` on `users`.`id` = `notary`.`to` + WHERE `notary`.`method` = 'Face to Face Meeting' GROUP BY `notary`.`to` HAVING count(*) > '".intval($no_of_assurees)."'"); return intval(query_get_number_of_rows($res)+1); } @@ -276,15 +278,6 @@ - - - - $max_experience) { @@ -443,7 +436,7 @@ if ($sum_points_countable < $max_points) { if ($sum_experience_countable != 0) - $remark_experience = $points_on_hold_txt;_("Points on hold due to less assurance points"); + $remark_experience = _("Points on hold due to less assurance points"); $sum_experience_countable = 0; if ($sum_experience_other_countable != 0) $remark_experience_other = _("Points on hold due to less assurance points"); @@ -453,7 +446,15 @@ $issue_points = 0; $cats_test_passed = get_cats_state ($userid); if ($cats_test_passed == 0) + { $issue_points_txt = ""._("You have to pass the CAcert Assurer Challenge (CATS-Test) to be an Assurer").""; + if ($sum_points_countable < $max_points) + { + $issue_points_txt = ""; + $issue_points_txt .= sprintf(_("You need %s assurance points and the passed CATS-Test to be an Assurer"), intval($max_points)); + $issue_points_txt .= ""; + } + } else { $experience_total = $sum_experience_countable+$sum_experience_other_countable; -- cgit v1.2.1 From 5e62a3c27b927d45498f8b56ee7561b2a8204d0d Mon Sep 17 00:00:00 2001 From: dirk Date: Tue, 23 Aug 2011 23:40:09 +0200 Subject: bug-827 optimized sql-queries for # of position etc. --- includes/wot.inc.php | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) (limited to 'includes') diff --git a/includes/wot.inc.php b/includes/wot.inc.php index a21f78a..50d615f 100644 --- a/includes/wot.inc.php +++ b/includes/wot.inc.php @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ +*/ function query_init ($query) { @@ -34,9 +34,8 @@ function get_number_of_assurances ($userid) { - $res = query_init ("SELECT `users`. *, count(*) AS `list` FROM `users`, `notary` - WHERE `users`.`id` = `notary`.`from` AND `notary`.`method` = 'Face to Face Meeting' AND `from`='".intval($userid)."' - GROUP BY `notary`.`from`"); + $res = query_init ("SELECT count(*) AS `list` FROM `notary` + WHERE `method` = 'Face to Face Meeting' AND `from`='".intval($userid)."' "); $row = query_getnextrow($res); return intval($row['list']); @@ -44,9 +43,8 @@ function get_number_of_assurees ($userid) { - $res = query_init ("SELECT `users`. *, count(*) AS `list` FROM `users`, `notary` - WHERE `users`.`id` = `notary`.`to` AND `notary`.`method` = 'Face to Face Meeting' AND `to`='".intval($userid)."' - GROUP BY `notary`.`to`"); + $res = query_init ("SELECT count(*) AS `list` FROM `notary` + WHERE `method` = 'Face to Face Meeting' AND `to`='".intval($userid)."' "); $row = query_getnextrow($res); return intval($row['list']); @@ -54,43 +52,41 @@ function get_top_assurer_position ($no_of_assurances) { - $res = query_init ("SELECT count(*) AS `list` FROM `users` - inner join `notary` on `users`.`id` = `notary`.`from` - WHERE `notary`.`method` = 'Face to Face Meeting' - GROUP BY `notary`.`from` HAVING count(*) > '".intval($no_of_assurances)."'"); + $res = query_init ("SELECT count(*) AS `list` FROM `notary` + WHERE `method` = 'Face to Face Meeting' + GROUP BY `from` HAVING count(*) > '".intval($no_of_assurances)."'"); return intval(query_get_number_of_rows($res)+1); } function get_top_assuree_position ($no_of_assurees) { - $res = query_init ("SELECT count(*) AS `list` FROM `users` - inner join `notary` on `users`.`id` = `notary`.`to` - WHERE `notary`.`method` = 'Face to Face Meeting' - GROUP BY `notary`.`to` HAVING count(*) > '".intval($no_of_assurees)."'"); + $res = query_init ("SELECT count(*) AS `list` FROM `notary` + WHERE `method` = 'Face to Face Meeting' + GROUP BY .`to` HAVING count(*) > '".intval($no_of_assurees)."'"); return intval(query_get_number_of_rows($res)+1); } function get_given_assurances ($userid) { - $res = query_init ("select * from `notary` where `notary`.`from`='".intval($userid)."' and `notary`.`from` != `to` order by `notary`.`id` asc"); + $res = query_init ("select * from `notary` where `from`='".intval($userid)."' and `from` != `to` order by `id` asc"); return $res; } function get_received_assurances ($userid) { - $res = query_init ("select * from `notary` where `notary`.`to`='".intval($userid)."' and `notary`.`from` != `notary`.`to` order by `notary`.`id` asc "); + $res = query_init ("select * from `notary` where `to`='".intval($userid)."' and `from` != `to` order by `id` asc "); return $res; } function get_given_assurances_summary ($userid) { - $res = query_init ("select count(*) as number,points,awarded,method from notary where `notary`.`from`='".intval($userid)."' group by points,awarded,method"); + $res = query_init ("select count(*) as number,points,awarded,method from notary where `from`='".intval($userid)."' group by points,awarded,method"); return $res; } - + function get_received_assurances_summary ($userid) { - $res = query_init ("select count(*) as number,points,awarded,method from notary where `notary`.`to`='".intval($userid)."' group by points,awarded,method"); + $res = query_init ("select count(*) as number,points,awarded,method from notary where `to`='".intval($userid)."' group by points,awarded,method"); return $res; } @@ -130,7 +126,7 @@ $awarded = 100; } else - $experience = 0; + $experience = 0; switch ($row['method']) { @@ -288,7 +284,7 @@ $res = get_given_assurances(intval($userid)); while($row = mysql_fetch_assoc($res)) { - $fromuser = get_user (intval($row['to'])); + $fromuser = get_user (intval($row['to'])); calc_experience ($row,$points,$experience,$sum_experience); $name = show_user_link ($fromuser['fname']." ".$fromuser['lname'],intval($row['to'])); output_assurances_row (intval($row['id']),$row['date'],$name,intval($row['awarded']),$row['location'],$row['method']==""?"":_(sprintf("%s", $row['method'])),$experience); -- cgit v1.2.1 From 32b9c96fa2216ce8a8a0ae8a8ea1defe18d67b67 Mon Sep 17 00:00:00 2001 From: dirk Date: Tue, 23 Aug 2011 23:56:01 +0200 Subject: bug-827 removed '.', which i forgot at last commit --- includes/wot.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'includes') diff --git a/includes/wot.inc.php b/includes/wot.inc.php index 50d615f..05ce449 100644 --- a/includes/wot.inc.php +++ b/includes/wot.inc.php @@ -62,7 +62,7 @@ { $res = query_init ("SELECT count(*) AS `list` FROM `notary` WHERE `method` = 'Face to Face Meeting' - GROUP BY .`to` HAVING count(*) > '".intval($no_of_assurees)."'"); + GROUP BY `to` HAVING count(*) > '".intval($no_of_assurees)."'"); return intval(query_get_number_of_rows($res)+1); } -- cgit v1.2.1