version: Properly handle missing test results

This commit is contained in:
Alexander Nicolaysen Sørnes
2007-11-04 23:09:12 +01:00
committed by Chris Morgan
parent 2aad57fbec
commit 5c6b3bb45e
3 changed files with 54 additions and 11 deletions

View File

@@ -63,6 +63,12 @@ div.info_contents { padding:10px; background-color: #eee; }
div.title_class { font-weight: bold; border-bottom: 1px solid; padding: 4px;
font-size: 140%; background-color: #ddd; }
/* Classes for a note box */
div.note_container { margin:6px; border: 1px solid; }
div.note_body { padding: 10px; background-color: #ffe732; }
div.note_title { font-weight: bold; border-bottom: 1px solid; padding: 4px;
font-size: 140%; background-color: #ffc004; }
/* classes for the main page */
div.rating_header { padding: 8px; }
div.rating_title { padding-bottom: 4px; font-weight: bold; font-size: 160%; }

View File

@@ -286,4 +286,18 @@ function make_inx_option_list($varname, $inx = null)
}
/* Displays a note box */
function html_note($shTitle, $shBody)
{
$shRet = '<div class="note_container">';
$shRet .= '<div class="note_title">';
$shRet .= $shTitle;
$shRet .= '</div>';
$shRet .= '<div class="note_body">';
$shRet .= $shBody;
$shRet .= '</div></div>';
return $shRet;
}
?>

View File

@@ -987,11 +987,7 @@ class version {
//////////////////////
// Show test data
echo "<div class='info_container'>\n";
echo "\t<div class='title_class'>\n";
echo "\t\tSelected test results <small><small>(selected in 'Test Results' table below)</small></small>\n";
echo "\t</div>\n";
/* Set if the use chose to display a particular test report */
if($iTestingId)
@@ -999,18 +995,45 @@ class version {
else if($this->iVersionId) /* Let's query for the latest rest report */
{
$iTestingId = testData::getNewestTestIdFromVersionId($this->iVersionId);
$oTest = new testData($iTestingId);
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 */
{
$aTests = $this->getTestResults();
$oTest = $aTests[0];
if(sizeof($aTests)) /* ... but we cannot be certain */
$oTest = $aTests[0];
}
echo "<div class='info_contents'>\n";
$oTest->ShowTestResult();
echo "</div>\n";
if($oTest)
{
echo "<div class='info_container'>\n";
echo "</div>\n"; // end the 'info_container' div
echo "\t<div class='title_class'>\n";
echo "\t\tSelected test results <small><small>(selected in 'Test Results' table below)</small></small>\n";
echo "\t</div>\n";
echo "<div class='info_contents'>\n";
$oTest->ShowTestResult();
echo "</div>\n";
echo "</div>\n";
} else /* Show a note saying that no test results are present,
and encourage the user to take action */
{
echo html_note('No Test Results',
'This version has no test results, please consider submitting some.<br />'.
'They may be part of the '.
'version or application description. If they are, please '.
'consider becoming a maintainer and remove them, submitting '.
'a proper test report instead.');
}
// end the 'info_container' div
// end show test data
/////////////////////
@@ -1020,7 +1043,7 @@ class version {
if($oTest->iTestingId)
{
$oTest->ShowVersionsTestingTable($this->objectMakeUrl()."&iTestingId=", 5);
} else /* We are previewing the version */
} else if($oTest) /* We are previewing the version */
{
$oTable = $oTest->CreateTestTable();
$oTable->AddRow($oTest->CreateTestTableRow(0, ""));