From 16fa03212bc6cabe2f47e93d06c0def10d46b353 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 23 Mar 2010 11:25:36 -0700 Subject: [PATCH] Ticket 2188: add a daily average post count to profile statistics sidebar. When we have more detailed history stats, this'd be a good place to link to details/graphs. --- lib/profileaction.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/profileaction.php b/lib/profileaction.php index 029c21845d..072c024c74 100644 --- a/lib/profileaction.php +++ b/lib/profileaction.php @@ -169,6 +169,12 @@ class ProfileAction extends OwnerDesignAction $subbed_count = $this->profile->subscriberCount(); $notice_count = $this->profile->noticeCount(); $group_count = $this->user->getGroups()->N; + $age_days = (time() - strtotime($this->profile->created)) / 86400; + if ($age_days < 1) { + // Rather than extrapolating out to a bajillion... + $age_days = 1; + } + $daily_count = round($notice_count / $age_days); $this->elementStart('div', array('id' => 'entity_statistics', 'class' => 'section')); @@ -219,6 +225,12 @@ class ProfileAction extends OwnerDesignAction $this->element('dd', null, $notice_count); $this->elementEnd('dl'); + $this->elementStart('dl', 'entity_daily_notices'); + // TRANS: Average count of posts made per day since account registration + $this->element('dt', null, _('Daily average')); + $this->element('dd', null, $daily_count); + $this->elementEnd('dl'); + $this->elementEnd('div'); }