Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

display statistics for repo

  • Loading branch information...
commit accbb95cc3939e873d99305c7f12e63cffa22f83 1 parent 0070e4b
@juzna authored
View
13 app/lib/helpers.php
@@ -25,6 +25,19 @@
*/
class Helpers
{
+
+ public static function interval($seconds) {
+ $periods = array("second", "minute", "hour", "day", "week", "month", "year", "decade");
+ $lengths = array("60","60","24","7","4.35","12","10");
+ for($j = 0; $seconds >= $lengths[$j]; $j++)
+ $seconds /= $lengths[$j];
+
+ $seconds = round($seconds, 2);
+ if($seconds != 1) $periods[$j].= "s";
+
+ return "$seconds $periods[$j]";
+ }
+
public static function ago($time) {
if (!$time) {
return FALSE;
View
1  app/presenters/BasePresenter.php
@@ -18,6 +18,7 @@ protected function createTemplate($class = NULL) {
$template = parent::createTemplate($class);
$template->registerHelper('timeAgoInWords', 'Helpers::ago');
$template->registerHelper('timeAgoInWordsEx', 'Helpers::agoEx');
+ $template->registerHelper('interval', 'Helpers::interval');
return $template;
}
}
View
5 app/templates/Homepage/default.latte
@@ -23,6 +23,7 @@ td.status.error { color: red; }
<th>Last pull</th>
<th>Last generated</th>
<th>Status</th>
+ <th>Statistics</th>
</tr></thead>
<tbody>
<tr n:foreach="$repos as $repo">
@@ -39,6 +40,10 @@ td.status.error { color: red; }
<a n:tag-if="$repo->apigenResultId" n:href="Homepage:result $repo->id">{= !$repo->error ? 'OK' : 'failed'}</a>
{/if}
</td>
+ <td class="notImportant">
+ <span n:if="$repo->apigenTime" title="Time to generate doc">{$repo->apigenTime|interval}</span>{if $repo->apigenTime && $repo->sizeDoc},{/if}
+ <span n:if="$repo->sizeDoc" title="Size of generated doc">{$repo->sizeDoc|bytes}</span>
+ </td>
</tr>
</tbody>
</table>
Please sign in to comment.
Something went wrong with that request. Please try again.