diff --git a/PHPCI/View/SummaryTable.phtml b/PHPCI/View/SummaryTable.phtml index 10782a5b..56df6e38 100644 --- a/PHPCI/View/SummaryTable.phtml +++ b/PHPCI/View/SummaryTable.phtml @@ -3,17 +3,32 @@ use PHPCI\Helper\Lang; foreach($projects as $project): $statuses = array(); - $successes = 0; $failures = 0; - $subcls = ''; + $subcls = 'yellow'; $cls = ''; $success = null; $failure = null; if (count($builds[$project->getId()])) { + // Get the most recent build status to determine the main block colour. + $last_build = $builds[$project->getId()][0]; + $status = $last_build->getStatus(); + switch($status) { + case 0: + $subcls = 'blue'; + break; + case 1: + $subcls = 'yellow'; + break; + case 2: + $subcls = 'green'; + break; + case 3: + $subcls = 'red'; + break; + } // Use the last 5 builds to determine project health: - $successes = 0; $failures = 0; foreach ($builds[$project->getId()] as $build) { @@ -25,7 +40,6 @@ foreach($projects as $project): $statuses[] = 'running'; break; case 2: - $successes++; $statuses[] = 'ok'; $success = is_null($success) && !is_null($build->getFinished()) ? Lang::formatDateTime($build->getFinished()) : $success; break; @@ -38,15 +52,6 @@ foreach($projects as $project): } } - if ($failures == 0) { - $subcls = 'green'; - } elseif ($successes == 0) { - $subcls = 'red'; - } else { - $subcls = 'yellow'; - } - - $buildCount = count($builds[$project->getId()]); $lastSuccess = $successful[$project->getId()]; $lastFailure = $failed[$project->getId()]; @@ -77,24 +82,31 @@ foreach($projects as $project): ?> + 10) { + $containerClass = 'small-box-minimal'; + } else { + $containerClass = 'small-box-full'; + } +?> + +