cvs: pearweb /public_html/pepr pepr-qa-stats.php

From: Date: Tue, 01 Mar 2005 20:32:28 +0000
Subject: cvs: pearweb /public_html/pepr pepr-qa-stats.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-cvs+get-29970@lists.php.net to get a copy of this message
toby Tue Mar 1 15:32:28 2005 EDT Modified files: /pearweb/public_html/pepr pepr-qa-stats.php Log: * More complicated, but seems to be necessary with MySQL. http://cvs.php.net/diff.php/pearweb/public_html/pepr/pepr-qa-stats.php?r1=1.6&r2=1.7&ty=u Index: pearweb/public_html/pepr/pepr-qa-stats.php diff -u pearweb/public_html/pepr/pepr-qa-stats.php:1.6 pearweb/public_html/pepr/pepr-qa-stats.php:1.7 --- pearweb/public_html/pepr/pepr-qa-stats.php:1.6 Tue Mar 1 14:29:08 2005 +++ pearweb/public_html/pepr/pepr-qa-stats.php Tue Mar 1 15:32:27 2005 @@ -18,7 +18,7 @@ * @author Tobias Schlitt <toby@php.net> * @copyright Copyright (c) 1997-2005 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License - * @version $Id: pepr-qa-stats.php,v 1.6 2005/03/01 19:29:08 toby Exp $ + * @version $Id: pepr-qa-stats.php,v 1.7 2005/03/01 20:32:27 toby Exp $ */ // Should require pear.qa karma later. @@ -52,7 +52,16 @@ // Fetch proposals with proposal date before 30 days ago // Get IDs from proposals with comments in the last 30 days -$sql = "SELECT pkg_prop_id FROM package_proposal_comments ppc WHERE FROM_UNIXTIME(timestamp) > DATE_ADD(NOW(), INTERVAL - 30 DAY);"; +$sql = <<<EOS +SELECT + ppc.pkg_prop_id, + MAX(ppc.timestamp) AS latest +FROM + package_proposal_comments ppc +WHERE + FROM_UNIXTIME(timestamp) > DATE_ADD(NOW(), INTERVAL - 30 DAY) +GROUP BY ppc.pkg_prop_id +EOS; $resProposals = $dbh->getAll($sql, DB_FETCHMODE_ASSOC); @@ -60,6 +69,7 @@ foreach ($resProposals as $proposal) { $proposalIds[$proposal['id']] = $proposal['pkg_prop_id']; + $proposalLatest[$proposal['id']] = $proposal['pkg_prop_id']; } // Get IDs from proposals with changes in the last 30 days @@ -111,6 +121,22 @@ } $sql = ' +SELECT + pp.id AS id +FROM + packages AS p + LEFT JOIN package_proposals AS pp + ON LOWER(p.name) LIKE CONCAT("%", LOWER(pp.pkg_name), "%") +'; + +$resProposalSets = $dbh->getAll($sql, DB_FETCHMODE_ASSOC); + +foreach ($resProposalSets as $set) { + if (isset($resProposals[$set['id']])) { + unset($resProposals[$set['id']]); + } +} +$sql = ' SELECT pp.id AS id, pp.pkg_name AS pkg_name, @@ -118,19 +144,15 @@ UNIX_TIMESTAMP(pp.draft_date) AS draft_date, UNIX_TIMESTAMP(pp.proposal_date) AS proposal_date, UNIX_TIMESTAMP(pp.vote_date) AS vote_date, - UNIX_TIMESTAMP(pp.longened_date) AS longened_date, - p.name AS name + UNIX_TIMESTAMP(pp.longened_date) AS longened_date FROM - packages AS p - LEFT JOIN package_proposals AS pp - ON LOWER(p.name) NOT LIKE CONCAT("%", LOWER(pp.pkg_name), "%") + package_proposals AS pp WHERE pp.status = "finished" AND pkg_category != "RFC" AND pp.id IN('.implode(', ', $resProposals).') AND pp.vote_date < DATE_ADD(NOW(), INTERVAL -30 DAY) AND pp.longened_date < DATE_ADD(NOW(), INTERVAL -30 DAY) -GROUP BY pp.pkg_name ORDER BY pp.draft_date DESC'; $res['orphan_finished'] = $dbh->getAll($sql, DB_FETCHMODE_ASSOC);

« previous php.pear.cvs (#29970) next »