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-26 04:42 am

[dw-free] Business statistics

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

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

Track account level while tracking active users.

Patch by [personal profile] pauamma.

Files modified:
  • bin/upgrading/update-db-general.pl
  • cgi-bin/LJ/User.pm
--------------------------------------------------------------------------------
diff -r 93d4ae733207 -r e740280188dc bin/upgrading/update-db-general.pl
--- a/bin/upgrading/update-db-general.pl	Mon Oct 26 03:56:27 2009 +0000
+++ b/bin/upgrading/update-db-general.pl	Mon Oct 26 04:42:18 2009 +0000
@@ -1518,12 +1518,18 @@ post_create("comminterests",
             });
 
 # tracking where users are active
+# accountlevel is the account level at time of activity
+# (may be NULL for transition period or long-term inactive
+# accounts that were active earlier - but not all inactive accounts will be in
+# there, so we won't be looking here for their account levels anyway, so this
+# shouldn't be a problem)
 register_tablecreate("clustertrack2", <<'EOC'); # clustered
 CREATE TABLE clustertrack2 (
     userid INT UNSIGNED NOT NULL,
     PRIMARY KEY (userid),
     timeactive INT UNSIGNED NOT NULL,
     clusterid SMALLINT UNSIGNED,
+    accountlevel SMALLINT UNSIGNED,
 
     INDEX (timeactive, clusterid)
 )
@@ -3818,6 +3824,12 @@ EOF
         set_dbnote( "logkwsum_fix_filtered_counts", 1 );
     }
 
+    unless ( column_type( 'clustertrack2', 'accountlevel' ) ) {
+        do_alter( 'clustertrack2',
+                  q{ALTER TABLE clustertrack2 ADD COLUMN accountlevel SMALLINT UNSIGNED AFTER clusterid} );
+    }
+
+
 });
 
 
diff -r 93d4ae733207 -r e740280188dc cgi-bin/LJ/User.pm
--- a/cgi-bin/LJ/User.pm	Mon Oct 26 03:56:27 2009 +0000
+++ b/cgi-bin/LJ/User.pm	Mon Oct 26 04:42:18 2009 +0000
@@ -5946,9 +5946,10 @@ sub mark_user_active {
 
         return 0 unless $u->writer;
         my $active = time();
-        $u->do("REPLACE INTO clustertrack2 SET ".
-               "userid=?, timeactive=?, clusterid=?", undef,
-               $uid, $active, $u->clusterid) or return 0;
+        $u->do( "REPLACE INTO clustertrack2 SET ".
+                "userid=?, timeactive=?, clusterid=?, accountlevel=?", undef,
+                $uid, $active, $u->clusterid, DW::Pay::get_current_account_status( $uid ) ) or return 0;
+
         my $memkey = [$u->userid, "timeactive:" . $u->userid];
         LJ::MemCache::set($memkey, $active, 86400);
     }
--------------------------------------------------------------------------------

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