This patch is meant to start a discussion more than anything else. We currently
have no way of sorting test results in a reasonable order. If we sort by
testedRating the order is not what we want. IE: Bronze, Garbage, Gold, Platinum
and Silver.
It might be better in the long run to replace testedRating in testResults with
ratingId. That however is a fairly big project.
(You need to run the table/testRating.sql script in mysql to test this patch
out.)
Change Log: Sort test results by rating in distributions
Files Changed: include/distributions.php
New File: tables/testRating.sql
--- /dev/null 2006-07-03 01:20:53.128621500 -0600
+++ tables/testRating.sql 2006-07-08 14:10:25.000000000 -0600
@@ -0,0 +1,18 @@
+use apidb;
+
+drop table if exists testRatings;
+
+/*
+ * link a bug to a version of an application
+ */
+create table testRatings (
+ ratingId int not null auto_increment,
+ testedRating tinytext,
+ key(ratingId)
+);
+
+INSERT INTO testRatings VALUES ('1', 'Platinum');
+INSERT INTO testRatings VALUES ('2', 'Gold');
+INSERT INTO testRatings VALUES ('3', 'Silver');
+INSERT INTO testRatings VALUES ('4', 'Bronze');
+INSERT INTO testRatings VALUES ('5', 'Garbage');
Index: include/distributions.php
===================================================================
RCS file: /home/wine/appdb/include/distributions.php,v
retrieving revision 1.10
diff -u -u -r1.10 distributions.php
--- include/distributions.php 6 Jul 2006 17:27:54 -0000 1.10
+++ include/distributions.php 8 Jul 2006 20:12:30 -0000
@@ -49,19 +49,23 @@
if($_SESSION['current']->hasPriv("admin"))
{
$sQuery = "SELECT testingId
- FROM testResults
- WHERE distributionId = '?'";
+ FROM testResults, testRatings
+ WHERE distributionId = '?' AND
+ testResults.testedRating = testRatings.testedRating
+ ORDER BY ratingId" ;
} else /* only let users view test results that aren't queued and for apps that */
/* aren't queued or versions that aren't queued */
{
$sQuery = "SELECT testingId
- FROM testResults, appFamily, appVersion
+ FROM testResults, appFamily, appVersion, testRating
WHERE testResults.queued = 'false' AND
testResults.versionId = appVersion.versionId AND
appFamily.appId = appVersion.appId AND
appFamily.queued = 'false' AND
appVersion.queued = 'false' AND
- distributionId = '?'";
+ testResults.testedRating = testRatings.testedRating AND
+ distributionId = '?'
+ ORDER BY ratingId" ;
}
if($hResult = query_parameters($sQuery, $iDistributionId))