журнал журнал (shhh) wrote in changelog,
журнал журнал
shhh
changelog

[livejournal] r22601: LJSUP-13204: Use 'reader weight' in repo...

Committer: nnikulochkina
LJSUP-13204: Use 'reader weight' in repost cost calculation
U   trunk/cgi-bin/LJ/User.pm
Modified: trunk/cgi-bin/LJ/User.pm
===================================================================
--- trunk/cgi-bin/LJ/User.pm	2012-08-08 12:10:02 UTC (rev 22600)
+++ trunk/cgi-bin/LJ/User.pm	2012-08-08 12:26:59 UTC (rev 22601)
@@ -2902,6 +2902,34 @@
 }
 
 # <LJFUNC>
+# name: LJ::User::get_reader_weight
+# des: returns reader_weight of user
+# </LJFUNC>
+
+sub get_reader_weight {
+    my ($u) = @_;
+
+    my $memkey = join ':', $u->userid, 'reader_weight';
+
+    my $reader_weight = LJ::MemCache::get( $memkey );
+
+    return $reader_weight if defined $reader_weight;
+
+    my $resp = LJ::PersonalStats::DB->fetch_raw('ratings', {
+        func => 'get_reader_weight',
+        journal_id => $u->userid,
+    });
+
+    return undef unless $resp;
+ 
+    $reader_weight = $resp->{reader_weight};
+
+    LJ::MemCache::set( $memkey, $reader_weight, 60*60);
+
+    return $reader_weight;
+}
+
+# <LJFUNC>
 # name: LJ::User::activate_userpics
 # des: Sets/unsets userpics as inactive based on account caps.
 # returns: nothing

Tags: livejournal, nikulochkina, nnikulochkina, pm
Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments