holyandrew (holyandrew) wrote in changelog,
holyandrew
holyandrew
changelog

[livejournal] r22098: LJSUP-12319: We need to display social c...

Committer: akanashin
LJSUP-12319: We need to display social capital for users which turn off Ratings
U   trunk/htdocs/tools/endpoints/ctxpopup.bml
Modified: trunk/htdocs/tools/endpoints/ctxpopup.bml
===================================================================
--- trunk/htdocs/tools/endpoints/ctxpopup.bml	2012-05-29 12:41:17 UTC (rev 22097)
+++ trunk/htdocs/tools/endpoints/ctxpopup.bml	2012-05-29 12:58:57 UTC (rev 22098)
@@ -122,27 +122,31 @@
     if ($u && ($u->is_personal || $u->is_comm)) {
         my ($position, $first, $soc_capital);
 
-        $position = LJ::PersonalStats::DB->fetch_raw('ratings', {
-            func => 'get_value',
-            what => $u->journaltype eq 'C' ? 'communities' : 'users',
-            journal_id => $u->userid,
-            by => 'friends_weight',
-            type => 0,
-            sup =>  LJ::SUP->is_sup_enabled($u) ? 1 : 0,
-        });
+        if ( $u->journaltype eq 'C' || LJ::SUP->is_sup_enabled($u)) {
 
-        $soc_capital = LJ::PersonalStats::DB->fetch_raw('ratings', {
-            func => 'get_authority',
-            journal_id => $u->userid,
-        });
+            $position = LJ::PersonalStats::DB->fetch_raw('ratings', {
+                func => 'get_value',
+                what => $u->journaltype eq 'C' ? 'communities' : 'users',
+                journal_id => $u->userid,
+                by => 'friends_weight',
+                type => 0,
+                sup =>  LJ::SUP->is_sup_enabled($u) ? 1 : 0,
+            });
 
-        if (ref $position eq 'HASH' && ( $u->journaltype eq 'C' || LJ::SUP->is_sup_enabled($u) )) {
-            $first = $position->{result}->{position}!=0 ? 0 : 1;
+            $soc_capital = LJ::PersonalStats::DB->fetch_raw('ratings', {
+                func => 'get_authority',
+                journal_id => $u->userid,
+            });
+
+            if (ref $position eq 'HASH') {
+                $first = $position->{result}->{position}!=0 ? 0 : 1;
+            }
+
+            $soc_capital = int($soc_capital->{result}->{authority}/1000);
+            $soc_capital = $soc_capital < 10 ? BML::ml('.social_capital_less_that') : LJ::commafy($soc_capital);
+
         }
 
-        $soc_capital = int($soc_capital->{result}->{authority}/1000);
-        $soc_capital = $soc_capital < 10 ? BML::ml('.social_capital_less_that') : LJ::commafy($soc_capital);
-
         $ret{first}  = $first; 
         $ret{value}  = $soc_capital;
         

Tags: akanashin, bml, holyandrew, livejournal
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