Jump to content

Rep


Curufinwe
 Share

Recommended Posts

And here is the solution:


   $DB->query("SELECT r.CODE, m.rep
               FROM members m
               LEFT JOIN reputation r ON (m.id = r.member_id and r.CODE = '01')
               WHERE m.id = '$memid' GROUP BY m.id");
   
   $ups = '';
   $downs = ''
   
   while( $info = $DB->fetch_row() )
   {
    if( $info['CODE'] == '01' ) $ups += 1;
    else $downs += 1;
   }
   $manually = abs( $info['rep'] - ($info['ups'] + $info['downs']) );
   
   $DB->query("SELECT m.id, m.name, m.rep
               FROM members m
               LEFT JOIN reputation r ON (m.id = r.member_id and r.CODE = '01')
               WHERE m.id = '$memid' GROUP BY m.id");
   
   $info = $DB->fetch_row();
   $info['upss'] = $ups;
   $info['downs'] = $downs;
   $info['manually'] = $manually;

Need another query to actually iterate over the rep changes and to assign the ups and downs. Now when we have done that we compare the real rep number to the sum of the ups and downs. The difference between them is the amount of rep that was manually changed, which we will need to supply the skin with to have some field "Manually changed'.

Well, I am not going to use this as I once in a while recount the reputation statistics and, as last time, manually changed rep gets lost then. :P

So we will stick with the current method. :P Just wanted to proove that I could solve this if I wanted to. :P

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...