Skip to content

Commit

Permalink
Fixes in health status view + removing repocomparison.php
Browse files Browse the repository at this point in the history
  • Loading branch information
TheoChevalier committed Mar 4, 2016
1 parent ec10869 commit a3c97f2
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 43 deletions.
3 changes: 0 additions & 3 deletions app/inc/dispatcher.php
Expand Up @@ -70,9 +70,6 @@
$page_descr = 'Show productization aspects for this locale.';
$css_include = ['productization.css'];
break;
case 'repocomparison':
$view = 'repocomparison';
break;
case 'rss':
$controller = 'changelog';
$template = false;
Expand Down
6 changes: 5 additions & 1 deletion app/models/health_status.php
Expand Up @@ -88,6 +88,7 @@

$locale_entities = $filter_pattern($locale);
$english_entities = $filter_pattern($ref_locale);
$english_strings = $locale_strings = [];

// Skip some special cases (mostly optional strings)
$path = [];
Expand Down Expand Up @@ -260,7 +261,10 @@ function ($entity) use ($path) {
$stats = Health::getStats($projects);
$translated = $stats['translated'];
$reference = $stats['total'];
$completion = round(($translated / $reference) * 100, 2);

// Making sure we never divide by zero while computing percentage
$completion = $reference == 0 ? 0 : round(($translated / $reference) * 100, 2);

$completion = $completion > 100 ? 100 : $completion;

// Get color from completion value
Expand Down
16 changes: 5 additions & 11 deletions app/views/health_status.php
@@ -1,14 +1,8 @@
<form name="searchform" id="simplesearchform" method="get" action="">
<fieldset id="main_search">
<fieldset>
<label>Locale</label>
<select name="locale" title="Locale">
<?=$target_locales_list?>
</select>
</fieldset>
<input type="submit" value="Go" alt="Go" />
</fieldset>
</form>
<?php

// Include the common simple search form
include __DIR__ . '/simplesearchform.php';
?>

<h3>Health Status for <?=$page_locale?></h3>
<div id="wrapper">
Expand Down
26 changes: 0 additions & 26 deletions app/views/repocomparison.php

This file was deleted.

6 changes: 4 additions & 2 deletions app/views/showrepos.php
Expand Up @@ -28,7 +28,7 @@

$string_count = [];

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

foreach ($gaia_locales as $val) {
Expand Down Expand Up @@ -57,7 +57,9 @@

foreach ($string_count as $locale => $numbers) {
$completion = $count_reference - $numbers['identical'] - $numbers['missing'];
$completion = number_format($completion / $count_reference * 100);

// Making sure we never divide by zero while computing percentage
$completion = $count_reference == 0 ? 0 : number_format($completion / $count_reference * 100);

if ($completion >= 99) {
$confidence = 'Highest';
Expand Down

0 comments on commit a3c97f2

Please sign in to comment.