From 73627e594d61e4606b57880cb35bdc50efb3e900 Mon Sep 17 00:00:00 2001 From: "terry%mozilla.org" <> Date: Tue, 12 Oct 1999 00:14:30 +0000 Subject: Added a "votes" field to the bugs table, which caches the total number of votes that have been cast for that bug. This let me simplify the SQL in buglist.cgi, which makes things more efficient and fixes several strange bugs. --- buglist.cgi | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'buglist.cgi') diff --git a/buglist.cgi b/buglist.cgi index f712f0b3e..6b8ae1446 100755 --- a/buglist.cgi +++ b/buglist.cgi @@ -173,7 +173,7 @@ DefCol("version", "substring(bugs.version, 1, 5)", "Vers", "bugs.version"); DefCol("os", "substring(bugs.op_sys, 1, 4)", "OS", "bugs.op_sys"); DefCol("target_milestone", "bugs.target_milestone", "TargetM", "bugs.target_milestone"); -DefCol("votes", "sum(votes.count) as votesum", "Votes", "votesum"); +DefCol("votes", "bugs.votes", "Votes", "bugs.votes"); my @collist; if (defined $::COOKIE{'COLUMNLIST'}) { @@ -229,7 +229,7 @@ bugs.bug_status"; $query .= " -from bugs left join votes on bugs.bug_id = votes.bug_id, +from bugs, profiles assign, profiles report left join profiles qacont on bugs.qa_contact = qacont.userid, @@ -248,7 +248,7 @@ if ((defined $::FORM{'emailcc1'} && $::FORM{'emailcc1'}) || # We need to poke into the CC table. Do weird SQL left join stuff so that # we can look in the CC table, but won't reject any bugs that don't have # any CC fields. - $query =~ s/bugs left join/bugs left join cc on bugs.bug_id = cc.bug_id left join profiles ccname on cc.who = ccname.userid left join/; + $query =~ s/bugs,/bugs left join cc on bugs.bug_id = cc.bug_id left join profiles ccname on cc.who = ccname.userid,/; } if (defined $::FORM{'sql'}) { @@ -366,6 +366,10 @@ if (defined $::FORM{'changedin'}) { } } +if (defined $minvotes) { + $query .= "and votes >= $minvotes "; +} + my $ref = $::MFORM{'chfield'}; @@ -407,7 +411,7 @@ if (defined $ref) { if (defined $ref && 0 < @$ref) { # Do surgery on the query to tell it to patch in the bugs_activity # table. - $query =~ s/profiles assign,/profiles assign, bugs_activity,/; + $query =~ s/bugs,/bugs, bugs_activity,/; my @list; foreach my $f (@$ref) { @@ -552,11 +556,6 @@ while (@row = FetchSQLData()) { # the same group. If they don't, we leave # it alone. } - if (defined $minvotes) { - if ($row[$votecolnum] < $minvotes) { - next; - } - } if (!defined $seen{$bug_id}) { $seen{$bug_id} = 1; $count++; -- cgit v1.2.3-24-g4f1b