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.
This commit is contained in:
Brion Vibber 2010-03-23 11:25:36 -07:00
parent 533a3bf6a3
commit 16fa03212b

View File

@ -169,6 +169,12 @@ class ProfileAction extends OwnerDesignAction
$subbed_count = $this->profile->subscriberCount(); $subbed_count = $this->profile->subscriberCount();
$notice_count = $this->profile->noticeCount(); $notice_count = $this->profile->noticeCount();
$group_count = $this->user->getGroups()->N; $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', $this->elementStart('div', array('id' => 'entity_statistics',
'class' => 'section')); 'class' => 'section'));
@ -219,6 +225,12 @@ class ProfileAction extends OwnerDesignAction
$this->element('dd', null, $notice_count); $this->element('dd', null, $notice_count);
$this->elementEnd('dl'); $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'); $this->elementEnd('div');
} }