]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Ticket 2188: add a daily average post count to profile statistics sidebar.
authorBrion Vibber <brion@pobox.com>
Tue, 23 Mar 2010 18:25:36 +0000 (11:25 -0700)
committerBrion Vibber <brion@pobox.com>
Tue, 23 Mar 2010 18:25:36 +0000 (11:25 -0700)
When we have more detailed history stats, this'd be a good place to link to details/graphs.

lib/profileaction.php

index 029c21845d6630088189eb2c2731537c92011e84..072c024c74a38c7d87ff7412c4f26f2b88f015fd 100644 (file)
@@ -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');
     }