Jump to content

Rep


Curufinwe
 Share

Recommended Posts

You guys beat me to it. :P

Okay this is where the problem is:

$info['downs'] = abs ($info['rep'] - $info['ups']);

As you see when 'rep' is bigger (because I changed it manually), the 'ups' do not change. That's why there will be more 'downs'. So I just have to change that formula here. :P

Link to comment
Share on other sites

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

(beer.gif

*looks at Tim's solution*

*tries to understand*

*understands*

*looking again*

*doesn't understand at all*

*gives up*

*goes and post in "Word Association" *

Anyway, it is easier to change the rep manually :lol: good job Timbo :)

and thanks for the rep changes too :P

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...