version: Make sure the displayed test results are for the displayed version

This commit is contained in:
Alexander Nicolaysen Sørnes
2009-01-30 20:55:32 +01:00
parent d43cb56dd6
commit ebc492dc1f
2 changed files with 16 additions and 2 deletions

View File

@@ -1035,11 +1035,20 @@ class version {
// Show test data
$iNewestId = 0;
$oTest = null;
/* Set if the use chose to display a particular test report */
if($iTestingId)
{
$oTest = new testData($iTestingId);
else if($this->iVersionId) /* Let's query for the latest rest report */
$oTestParent = $oTest->objectGetParent();
/* Check that the test report doesn't belong to another version */
if($oTestParent->objectGetId() && $oTestParent->objectGetId() != $this->objectGetId())
$oTest = null;
}
if(!$oTest && $this->iVersionId) /* Let's query for the latest rest report */
{
$iNewestId = testData::getNewestTestIdFromVersionId($this->iVersionId);
$iTestingId = $iNewestId;
@@ -1047,7 +1056,7 @@ class version {
if($iTestingId) /* We want all entries to have test data, but old versions might lack
it, or data may have been deleted */
$oTest = new testData($iTestingId);
} else /* Perhaps we have a cached entry? There should be */
} else if(!$oTest) /* Perhaps we have a cached entry? There should be */
{
$aTests = $this->getTestResults();