Jump to content
Sign in to follow this  
Curufinwe

Rep

Recommended Posts

:P Yeah, the bug has not really been fixed, but when I first looked at it I couldn't figure out what was causing it, but I will try another time.

I just figured it is not useful to lose so much time on it, if there is such a nice workaround. :P

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

*looks at Tim's solution*

*tries to understand*

*understands*

Yep :lol: I figure most of it out :)

you should make some tutorials Tim :P

Share this post


Link to post
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

Share this post


Link to post
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.

Sign in to follow this  

×
×
  • Create New...