cvs: pearweb /include/bugs pear-bugs.php
| From: | Helgi �ormar �orbj�rnsson | Date: | Fri, 21 Mar 2008 21:06:51 +0000 |
| Subject: | cvs: pearweb /include/bugs pear-bugs.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-7354@lists.php.net to get a copy of this message | ||
dufuz Fri Mar 21 21:06:51 2008 UTC
Modified files:
/pearweb/include/bugs pear-bugs.php
Log:
Request #11082 Package Summary (Bug) Request Report
# Also fixed so we don't do 2 queries to get count and total, subquery ftw!
# and total of bugs is now only bugs and docs, no features in it
http://cvs.php.net/viewvc.cgi/pearweb/include/bugs/pear-bugs.php?r1=1.12&r2=1.13&diff_format=u
Index: pearweb/include/bugs/pear-bugs.php
diff -u pearweb/include/bugs/pear-bugs.php:1.12 pearweb/include/bugs/pear-bugs.php:1.13
--- pearweb/include/bugs/pear-bugs.php:1.12 Thu Aug 16 19:24:26 2007
+++ pearweb/include/bugs/pear-bugs.php Fri Mar 21 21:06:51 2008
@@ -11,25 +11,44 @@
$this->_dbh = $GLOBALS['dbh'];
}
- function packageBugStats($packageid)
+ function packageBugStats($package)
{
- $info = $this->_dbh->getAll('
+ $type = ' bug_type IN ("Bug","Documentation Problem") AND ';
+ $sql = '
SELECT
+ (SELECT COUNT(bugdb.id) FROM bugdb WHERE bugdb.package_name = ? AND ' . $type
. ' bugdb.registered = 1) as total,
COUNT(bugdb.id) as count,
AVG(TO_DAYS(NOW()) - TO_DAYS(ts1)) as average,
MAX(TO_DAYS(NOW()) - TO_DAYS(ts1)) as oldest
FROM bugdb, packages
WHERE
- name=? AND
+ name = ? AND
bugdb.package_name = packages.name AND
status IN
("Open","Feedback","Assigned","Analyzed","Verified","Critical")
AND
- bug_type IN ("Bug","Documentation Problem") AND
- bugdb.registered = 1
- ', array($packageid), DB_FETCHMODE_ASSOC);
- $total = $this->_dbh->getOne('
- SELECT COUNT(bugdb.id) FROM bugdb WHERE bugdb.package_name=? AND bugdb.registered = 1
- ', array($packageid));
- return array_merge($info[0], array('total' => $total));
+ ' . $type . '
+ bugdb.registered = 1';
+ $info = $this->_dbh->getRow($sql, array($package, $package), DB_FETCHMODE_ASSOC);
+ return $info;
+ }
+
+ function packageFeatureStats($package)
+ {
+ $type = ' bug_type = "Feature/Change Request" AND ';
+ $sql = '
+ SELECT
+ (SELECT COUNT(bugdb.id) FROM bugdb WHERE bugdb.package_name = ? AND ' . $type
. ' bugdb.registered = 1) as total,
+ COUNT(bugdb.id) as count,
+ AVG(TO_DAYS(NOW()) - TO_DAYS(ts1)) as average,
+ MAX(TO_DAYS(NOW()) - TO_DAYS(ts1)) as oldest
+ FROM bugdb, packages
+ WHERE
+ name = ? AND
+ bugdb.package_name = packages.name AND
+ status IN
("Open","Feedback","Assigned","Analyzed","Verified","Critical")
AND
+ ' . $type . '
+ bugdb.registered = 1';
+ $info = $this->_dbh->getRow($sql, array($package, $package), DB_FETCHMODE_ASSOC);
+ return $info;
}
function bugRank()
@@ -235,5 +254,4 @@
arsort($bugs);
return $bugs;
}
-}
-?>
+}
\ No newline at end of file