[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    bugs/bugz
From:       Dirk Mueller <mueller () kde ! org>
Date:       2005-06-02 21:55:16
Message-ID: 1117749316.904274.12905.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 421365 by mueller:

adding bug-fixer topscoring list



 M  +7 -0      weekly-bug-summary.cgi  
 M  +71 -0     weekly-summary-utils.pl  


--- trunk/bugs/bugz/weekly-bug-summary.cgi #421364:421365
@@ -47,6 +47,8 @@
 if (defined $::FORM{'days'}){
     $days = int($::FORM{'days'});	 # turn to int for security reasons (might be used \
in SQL)  }
+$days = 7 if ($days == 0);
+
 my $tops = 20; 
 if (defined $::FORM{'tops'}){
     ($tops) = ($::FORM{'tops'} =~ m/^(\d+)$/);	# use only int for security reasons \
(might be used in SQL) @@ -107,6 +109,11 @@
 print "<h3 style=\"text-align:center;\">Top ".html_quote($tops)." people who \
resolved the most reports in the last ".html_quote($days)." days:</h3>";  \
&print_bug_hunters_list($tops, $days, "HTML");  
+print "<h3 style=\"text-align:center;\">Top ".html_quote($tops)." people who quickly \
fixed a report in the last  ".html_quote($days)." days:</h3>"; \
+&print_bug_hunters_list($tops, $days, "HTML"); +
+
+
 print "</div>\n";
 
 PutFooter();
--- trunk/bugs/bugz/weekly-summary-utils.pl #421364:421365
@@ -357,3 +357,74 @@
         print $fh "</bug-hunters>\n";
     }
 }
+
+sub print_bug_fixers_list() {
+    my($number, $days, $format, $fh) = @_;
+
+    my $query;
+    $days = SqlQuote($days);    #security
+        
+
+    # We are going to build a long SQL query.
+    $query = <<FIN;
+SELECT
+    profiles.login_name, bugs.bug_id, min(bugs_activity.bug_when-bugs.creation_ts) \
as open_time +FROM
+    bugs, bugs_activity, profiles
+WHERE
+    bugs.resolution='FIXED'
+AND
+    bugs.bug_status='RESOLVED'
+AND
+    bugs_activity.bug_when  >= FROM_DAYS(TO_DAYS(NOW())-$days)
+AND
+    bugs.bug_id=bugs_activity.bug_id
+AND
+    bugs_activity.added='FIXED'
+AND
+    bugs_activity.who=profiles.userid
+GROUP BY
+    profiles.login_name
+ORDER BY
+    open_time ASC
+LIMIT
+    $number
+
+FIN
+
+    if ($format eq "HTML") {
+            # Print a nice cross-referenced table of results.
+            print "<table border=\"0\" cellspacing=\"2\" cellpadding=\"5\">\n";
+            print "<tr style=\"background-color: #EEF6FF;\"><th>User</th><th># \
Resolved</th></tr>\n"; +    } else {
+            print $fh "<bug-fixers>\n";
+    }
+
+    SendSQL ($query);
+    while (my ($user, $bugid, $elapsed) = FetchSQLData()) {
+
+	# defang the email address
+	$user =~ y/\@\./  / if ($::userid == 0);
+        $user = html_quote($user);
+
+        if ($format eq "HTML") {
+               my $html_elapsed = "$elapsed seconds";
+               $html_elapsed = int($elapsed/60) . " minutes" if ($elapsed > 60);
+               $html_elapsed = int($elapsed/(60*60)) . " hours" if ($elapsed > 600);
+               $html_elapsed = int($elapsed/(60*60*24)) . " days" if ($elapsed > \
(36*60*60)); +               print <<FIN;
+                <tr>
+                    <td>$user</td>
+                    <td style="text-align:right;">$html_elapsed (bug <a \
href="show_bug.cgi?id=$bugid">$bugid</a>)</td> +                </tr>
+FIN
+        } else {
+               print $fh "<bug-item elapsed='$elapsed'>$user</bug-item>\n";
+        }
+    }
+    if ($format eq "HTML") {
+        print "</table><br />\n";
+    } else {
+        print $fh "</bug-fixers>\n";
+    }
+}


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic