mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-10-16 04:55 am

[dw-free] Business statistics

[commit: http://hg.dwscoalition.org/dw-free/rev/26da4077388b]

http://bugs.dwscoalition.org/show_bug.cgi?id=124

Add 'active accounts' to the admin stats page.

Patch by [personal profile] afuna.

Files modified:
  • htdocs/admin/stats.bml
--------------------------------------------------------------------------------
diff -r a5c6ae53e969 -r 26da4077388b htdocs/admin/stats.bml
--- a/htdocs/admin/stats.bml	Fri Oct 16 04:46:08 2009 +0000
+++ b/htdocs/admin/stats.bml	Fri Oct 16 04:55:42 2009 +0000
@@ -39,23 +39,37 @@ body<=
 
     # number of accounts, total
     my $accounts_by_type = DW::StatData::AccountsByType->load_latest( DW::StatStore->get( "accounts" ) );
-    $ret .= "<h2>Number of accounts</h2>";
-    $ret .= "<ul>";
-    $ret .= "<li><label>Total</label>: " . $accounts_by_type->value( "total" ) . "</li>";
-    $ret .= "<li><label>Personal</label>: " . $accounts_by_type->value( "personal" ) . "</li>";
-    $ret .= "<li><label>OpenID</label>: " . $accounts_by_type->value( "identity" ) . "</li>";
-    $ret .= "</ul>";
-    
+    if ( defined $accounts_by_type ) {
+        $ret .= "<h2>Number of accounts</h2>";
+        $ret .= "<ul>";
+        $ret .= "<li><label>Total</label>: " . $accounts_by_type->value( "total" ) . "</li>";
+        $ret .= "<li><label>Personal</label>: " . $accounts_by_type->value( "personal" ) . "</li>";
+        $ret .= "<li><label>OpenID</label>: " . $accounts_by_type->value( "identity" ) . "</li>";
+        $ret .= "</ul>";
+    }
+
     # number of accounts, active
-    
-    
+    my $active_accounts = DW::StatData::ActiveAccounts->load_latest( DW::StatStore->get( "active" ) );
+    my $active; # Used in paid account stats below
+    $ret .= "<h2>$ML{'/stats/site.bml.active.title'}</h2><p>$ML{'/stats/site.bml.active.desc'}</p>";
+ 
+    if ( defined $active_accounts ) {
+        $ret .= "<ul>";
+        $ret .= "<li>" . $ML{"/stats/site.bml.active.bytime.$_"} . " "
+                . $active_accounts->value( $_ ) . "</li>"
+            foreach qw/ active_1d active_7d active_30d /;
+        $ret .= "</ul>";
+        $active = $active_accounts->value( 'active_30d' );
+    } else {
+        $ret .= $ML{'/stats/site.bml.error.notavailable'};
+    }
     
 <<COMMENT;
 
 FIXME: remove this when you have implemented them all 
 
-* Number of accounts, total
-* Number of accounts active
+* Number of accounts, total (done)
+* Number of accounts active (done)
 * Number of paid accounts (by payment level)
   -- as a percentage of total accounts
   -- as a percentage of active accounts
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org