diff --git a/include/testResults.php b/include/testResults.php index 748869b..abd36f7 100644 --- a/include/testResults.php +++ b/include/testResults.php @@ -38,7 +38,7 @@ class testData{ if($hResult = query_parameters($sQuery, $iTestingId)) { $oRow = mysql_fetch_object($hResult); - $this->iTestingId = $iTestingId; + $this->iTestingId = $oRow->testingId; $this->iVersionId = $oRow->versionId; $this->sWhatWorks = $oRow->whatWorks; $this->sWhatDoesnt = $oRow->whatDoesnt; @@ -348,38 +348,20 @@ class testData{ mail_appdb($sEmail, $sSubject ,$sMsg); } - function ShowTestResult($iCurrentTest,$iVersionId) + function ShowTestResult() { - $hResult = query_parameters("SELECT * - FROM testResults - WHERE testingId = '?'", - $iCurrentTest); - if(!$hResult || mysql_num_rows($hResult) == 0) - { - $hResult = query_parameters("SELECT * - FROM testResults - WHERE versionId = '?' - ORDER BY testedDate DESC ;", - $iVersionId); - if(!$hResult || mysql_num_rows($hResult) == 0) - return false; - } - $oRow = mysql_fetch_object($hResult); echo '
What works
',"\n";
- echo $oRow->whatWorks;
+ echo $this->sWhatWorks;
echo '
What does not
',"\n";
- echo $oRow->whatDoesnt;
+ echo $this->sWhatDoesnt;
echo '
What was not tested
',"\n";
- echo $oRow->whatNotTested;
- return $oRow->testingId;
+ echo $this->sWhatNotTested;
}
// Show the Test results for a application version
- function ShowVersionsTestingTable($iVersionId, $iCurrentTest, $link, $iDisplayLimit)
+ function ShowVersionsTestingTable($link, $iDisplayLimit)
{
/* escape input parameters */
- $iVersionId = mysql_real_escape_string($iVersionId);
- $iCurrentTest = mysql_real_escape_string($iCurrentTest);
$link = mysql_real_escape_string($link);
$iDisplayLimit = mysql_real_escape_string($iDisplayLimit);
@@ -390,7 +372,7 @@ class testData{
$sQuery = "SELECT *
FROM testResults
- WHERE versionId = '".$iVersionId."'
+ WHERE versionId = '".$this->iVersionId."'
ORDER BY testedDate DESC";
if(!$showAll)
@@ -427,7 +409,9 @@ class testData{
$bgcolor = $oTest->sTestedRating;
echo '
| Description \n"; echo $this->sDescription; + // Show testing data - $oTest = new TestData($iTestingId); - $iCurrentTest = $oTest->ShowTestResult($oTest->iTestingId, $this->iVersionId); - if($iCurrentTest) + + $oTest = new testData($iTestingId); + + /* if $iTestingId wasn't valid then it won't be valid in $oTest */ + if(!$oTest->iTestingId) { - $oTest->ShowVersionsTestingTable($this->iVersionId, - $iCurrentTest, - $_SERVER['PHP_SELF']."?iVersionId=".$this->iVersionId."&iTestingId=", + /* fetch a new testing id for this version */ + $iTestingId = testData::get_test_for_versionid($this->iVersionId); + $oTest = new testData($iTestingId); + } + + $oTest->ShowTestResult(); + if($oTest->iTestingId) + { + $oTest->ShowVersionsTestingTable($_SERVER['PHP_SELF']."?iVersionId=".$this->iVersionId."&iTestingId=", 5); } echo ' |