holyandrew (holyandrew) wrote in changelog,
holyandrew
holyandrew
changelog

[livejournal] r22061: 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
U   trunk/htdocs/userinfo.bml
Modified: trunk/htdocs/tools/endpoints/ctxpopup.bml
===================================================================
--- trunk/htdocs/tools/endpoints/ctxpopup.bml	2012-05-25 08:40:36 UTC (rev 22060)
+++ trunk/htdocs/tools/endpoints/ctxpopup.bml	2012-05-25 10:49:36 UTC (rev 22061)
@@ -124,16 +124,12 @@
 
         $position = LJ::PersonalStats::DB->fetch_raw('ratings', {
             func => 'get_authority',
-            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) )) {
+        if (ref $position eq 'HASH') {
             $first = $position->{result}->{position}!=0 ? 0 : 1;
-            $soc_capital = int($position->{result}->{value}/1000);
+            $soc_capital = int($position->{result}->{authority}/1000);
             $soc_capital = $soc_capital < 10 ? BML::ml('.social_capital_less_that') : LJ::commafy($soc_capital);
 
             $ret{first}  = $first; 

Modified: trunk/htdocs/userinfo.bml
===================================================================
--- trunk/htdocs/userinfo.bml	2012-05-25 08:40:36 UTC (rev 22060)
+++ trunk/htdocs/userinfo.bml	2012-05-25 10:49:36 UTC (rev 22061)
@@ -664,7 +664,7 @@
             $country = $u->prop('country') if $u && $country ne 'UA';
             if ($country eq 'UA') {
                 $ua_position = LJ::PersonalStats::DB->fetch_raw('ratings', {
-                        func => 'get_authority',
+                        func => 'get_value',
                         what => $u->journaltype eq 'C' ? 'communities' : 'users',
                         journal_id => $u->userid,
                         by => 'friends_weight',
@@ -676,7 +676,7 @@
         #-------------------------------------------------------------------------------------
 
         $position = LJ::PersonalStats::DB->fetch_raw('ratings', {
-            func => 'get_authority',
+            func => 'get_value',
             what => $u->journaltype eq 'C' ? 'communities' : 'users',
             journal_id => $u->userid,
             by => 'friends_weight',
@@ -694,7 +694,8 @@
 
         if (ref $position eq 'HASH' && ( $u->journaltype eq 'C' || LJ::SUP->is_sup_enabled($u) )) {
                 $soc_image = "<img src='$LJ::IMGPREFIX/profile_icons/" . ($position->{result}->{position}!=0 ? 'social-capital.png?v=17298' : 'korona.png?v=17319') . "'/>";
-                $soc_capital = int($position->{result}->{value}/1000);
+                $soc_capital = LJ::PersonalStats::DB->fetch_raw('get_authority', {journal_id => $u->userid, sup =>  LJ::SUP->is_sup_enabled($u) ? 1 : 0}); 
+                $soc_capital = int($position->{result}->{authority}/1000);
                 $soc_capital = $soc_capital < 10 ? ' <10 ' : LJ::commafy($soc_capital);
                 my $country  = LJ::SUP->is_sup_enabled($u) ? 'cyr' : 'noncyr';
                 $body .= "<li class='rating-place'>" .
@@ -706,7 +707,8 @@
         }
         if (ref $ua_position eq 'HASH') {
                 $soc_image = "<img src='$LJ::IMGPREFIX/profile_icons/" . ($ua_position->{result}->{position}!=0 ? 'social-capital.png?v=17298' : 'korona.png?v=17319') . "'/>";
-                $soc_capital = int($ua_position->{result}->{value}/1000);
+                $soc_capital = LJ::PersonalStats::DB->fetch_raw('get_authority', {journal_id => $u->userid, filter => 'UA'}); 
+                $soc_capital = $soc_capital->{result}->{authority};
                 $soc_capital = $soc_capital < 10 ? ' <10 ' : LJ::commafy($soc_capital);
                 $body .= "<li class='rating-place'>" .
                          $diagram_image .

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