Skip to content

Commit a3c97f2

Browse files
committed
Fixes in health status view + removing repocomparison.php
1 parent ec10869 commit a3c97f2

5 files changed

Lines changed: 14 additions & 43 deletions

File tree

app/inc/dispatcher.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@
7070
$page_descr = 'Show productization aspects for this locale.';
7171
$css_include = ['productization.css'];
7272
break;
73-
case 'repocomparison':
74-
$view = 'repocomparison';
75-
break;
7673
case 'rss':
7774
$controller = 'changelog';
7875
$template = false;

app/models/health_status.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888

8989
$locale_entities = $filter_pattern($locale);
9090
$english_entities = $filter_pattern($ref_locale);
91+
$english_strings = $locale_strings = [];
9192

9293
// Skip some special cases (mostly optional strings)
9394
$path = [];
@@ -260,7 +261,10 @@ function ($entity) use ($path) {
260261
$stats = Health::getStats($projects);
261262
$translated = $stats['translated'];
262263
$reference = $stats['total'];
263-
$completion = round(($translated / $reference) * 100, 2);
264+
265+
// Making sure we never divide by zero while computing percentage
266+
$completion = $reference == 0 ? 0 : round(($translated / $reference) * 100, 2);
267+
264268
$completion = $completion > 100 ? 100 : $completion;
265269

266270
// Get color from completion value

app/views/health_status.php

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
1-
<form name="searchform" id="simplesearchform" method="get" action="">
2-
<fieldset id="main_search">
3-
<fieldset>
4-
<label>Locale</label>
5-
<select name="locale" title="Locale">
6-
<?=$target_locales_list?>
7-
</select>
8-
</fieldset>
9-
<input type="submit" value="Go" alt="Go" />
10-
</fieldset>
11-
</form>
1+
<?php
2+
3+
// Include the common simple search form
4+
include __DIR__ . '/simplesearchform.php';
5+
?>
126

137
<h3>Health Status for <?=$page_locale?></h3>
148
<div id="wrapper">

app/views/repocomparison.php

Lines changed: 0 additions & 26 deletions
This file was deleted.

app/views/showrepos.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
$string_count = [];
3030

31-
// Referen_ce locale count
31+
// Reference locale count
3232
$count_reference = count($strings['en-US'][$repo]);
3333

3434
foreach ($gaia_locales as $val) {
@@ -57,7 +57,9 @@
5757

5858
foreach ($string_count as $locale => $numbers) {
5959
$completion = $count_reference - $numbers['identical'] - $numbers['missing'];
60-
$completion = number_format($completion / $count_reference * 100);
60+
61+
// Making sure we never divide by zero while computing percentage
62+
$completion = $count_reference == 0 ? 0 : number_format($completion / $count_reference * 100);
6163

6264
if ($completion >= 99) {
6365
$confidence = 'Highest';

0 commit comments

Comments
 (0)