diff --git a/app/models/health_status.php b/app/models/health_status.php
index 2d53f262..ee0a1471 100644
--- a/app/models/health_status.php
+++ b/app/models/health_status.php
@@ -6,6 +6,7 @@
use VCS\Mercurial;
use VCS\Subversion;
+$projects = [];
foreach (Project::getRepositories() as $repo) {
// Get the right locale for this repo
@@ -243,45 +244,7 @@ function ($entity) use ($path) {
}
}
-// Get stats
-$stats = Health::getStats($projects);
-$translated = $stats['translated'];
-$reference = $stats['total'];
-
-$completion = round(($translated / $reference) * 100, 2);
-$completion = $completion > 100 ? 100 : $completion;
-
-// Get color from completion value
-$color = Utils::redYellowGreen($completion);
-
-// Get active projects
-$active_projects = '
Active projects:
';
-if (isset($projects['release']['repos'])) {
- $active_projects .= '- Desktop: ';
- foreach (array_keys($projects['release']['repos']) as $repo) {
- if (in_array($repo, array_keys(Project::$components_names))) {
- $active_projects .= Project::$components_names[$repo] . ', ';
- }
- }
- $active_projects .= '
';
-}
-
-if (isset($projects['gaia'])) {
- $active_projects .= '- Gaia: ';
- foreach (array_keys($projects['gaia']) as $repo) {
- $active_projects .= Project::getRepositoriesNames()[$repo] . ', ';
- }
- $active_projects .= '
';
-}
-
-if (isset($projects['others'])) {
- $active_projects .= '- Others: ';
- foreach (array_keys($projects['others']) as $repo) {
- $active_projects .= Project::getRepositoriesNames()[$repo] . ', ';
- }
- $active_projects .= '
';
-}
-$active_projects .= '
';
+$active_projects = '';
// Build locales select
$target_locales_list = '';
@@ -292,3 +255,45 @@ function ($entity) use ($path) {
$ch = ($loc == $locale) ? ' selected' : '';
$target_locales_list .= "\t\n";
}
+
+// Get stats
+if (! empty($projects)) {
+ $stats = Health::getStats($projects);
+ $translated = $stats['translated'];
+ $reference = $stats['total'];
+ $completion = round(($translated / $reference) * 100, 2);
+ $completion = $completion > 100 ? 100 : $completion;
+
+ // Get color from completion value
+ $color = Utils::redYellowGreen($completion);
+
+ // Get active projects
+ if (isset($projects['release']['repos'])) {
+ $active_projects .= 'Desktop: ';
+ $tmp_projects = [];
+ foreach (array_keys($projects['release']['repos']) as $repo) {
+ if (in_array($repo, array_keys(Project::$components_names))) {
+ $tmp_projects[] = Project::$components_names[$repo];
+ }
+ }
+ $active_projects .= implode(', ', $tmp_projects) . '';
+ }
+
+ if (isset($projects['gaia'])) {
+ $active_projects .= 'Gaia: ';
+ $tmp_projects = [];
+ foreach (array_keys($projects['gaia']) as $repo) {
+ $tmp_projects[] = Project::getRepositoriesNames()[$repo];
+ }
+ $active_projects .= implode(', ', $tmp_projects) . '';
+ }
+
+ if (isset($projects['others'])) {
+ $active_projects .= 'Others: ';
+ $tmp_projects = [];
+ foreach (array_keys($projects['others']) as $repo) {
+ $tmp_projects[] = Project::getRepositoriesNames()[$repo];
+ }
+ $active_projects .= implode(', ', $tmp_projects) . '';
+ }
+}
diff --git a/app/views/health_status.php b/app/views/health_status.php
index 5649942f..c763172e 100644
--- a/app/views/health_status.php
+++ b/app/views/health_status.php
@@ -12,8 +12,20 @@
Health Status for =$page_locale?>
+
- =$active_projects?>
+
The requested locale doesn't have any supported project.
+
+
+
+
Active projects:
+
General metrics:
- Global completion: ~=$completion?>%
@@ -29,4 +41,7 @@
=$content?>
+