clan net bug

Started by Shadow, March 25, 2009, 12:15:33 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Shadow

clan net readouts
                                                                    members  avg net                    total net
Woodlanders of Mossflower     Woodlander     10     $388,767,720     $5,053,980,358

Woodlanders have no foxes, so total net should be members * avg net, but it clearly isnt.

In fact, both the value are wrong - the true total net is 4,722,588,677 and the true average net is 472,258,868
<=holbs-.. ..-holbs=> <=holbs-..

windhound

$unallied = $utotal = 0;
while ($users = mysql_fetch_array($allusers))
{
   if ($n = $users[clan])
   {
      $members[$n]++;
      $totalnet[$n] += $users[networth];
      $avgnet[$n] = round($totalnet[$n] / $members[$n]);
   }
   else   $unallied++;
   $utotal++;
}



I cant imagine what's wrong with that
A Goldfish has an attention span of 3 seconds...  so do I
~ In the beginning there was nothing, which exploded ~
There are only 10 types of people in the world: Those who understand binary, and those who don't

Shadow

#2
The average net is being reported as though there are 5,053,980,358 / 388,767,720 = 13 members... but it lists 10 members. There are three members in protection though, so it must be counting those toward the member total when calculating average net but not including them in the member field. The total net is still off by like 300 million though, which is not on the three protected members :P
<=holbs-.. ..-holbs=> <=holbs-..

windhound

Mm.  Marketed net perhaps?
It keeps making unexpected appearances

And yeah, it would show the protection guys...  maybe even the disabled guys.  Its just looking for anyone with the right clan tag.
A Goldfish has an attention span of 3 seconds...  so do I
~ In the beginning there was nothing, which exploded ~
There are only 10 types of people in the world: Those who understand binary, and those who don't

Shadow

#4
Yes but it says we have 10 members right there in the member field, so that must be different index somewhere that counts that one. There is nothing in that code block about excluding members in protection. Marketed net could be right - when shael took it off the scores she may not have taken it off the clan totals - its really not an important bug, i just like picking things apart.
<=holbs-.. ..-holbs=> <=holbs-..

Shadow

Pretty sure I know what the problem is here -

Average net calculations include dead/disabled/protected warlords in the clan, and total net does not. The last one usually isn't much of an issue since protected warlords are only clanned in forces clan rounds, but the others could use a tweak if anyone stumbles across the relevent code.
<=holbs-.. ..-holbs=> <=holbs-..

windhound

I'll take another look at it in a bit

Its just such a low priority bug, the only time it really matters is really forced-clan turbo rounds
A Goldfish has an attention span of 3 seconds...  so do I
~ In the beginning there was nothing, which exploded ~
There are only 10 types of people in the world: Those who understand binary, and those who don't