FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Bug Reports » average counting
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
average counting [message #6399] Wed, 09 October 2002 19:09 Go to next message
zapal   Poland
Messages: 68
Registered: October 2002
Location: Poland
Karma: 0
Member
I noticed a bug in average post per day counting.

It returns number of all posts sends even though the user has joined the forum several days before.
I can also notice this bug for protoss on this forum
2468 messages (2468 average per day).

I use fud 2.3.2.

I've found out that line responsible for this is in theme/default/usrinfo.php, line 507 to 508.

It's sth like that (in pseudo code):
avg = posted_msg_count/((__request_timestamp__-join_date)/86400)
if (avg > posted_msg_count) avg=posted_msg_count


It looks as if it was the problem with rounded values (after dividing by 86400). Am I right?
Re: average counting [message #6401 is a reply to message #6399] Wed, 09 October 2002 19:38 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
What bug, it looks fine to :
Post Count:2469 Post(s) (9.01 average posts per day)

The code is fine, it is written in such a way that if a forum newcomer (person registered < 24 hours ago) makes lots of posts the average calculator does not generate a HUGE posts/per day avg for that person.


FUDforum Core Developer
Re: average counting [message #6402 is a reply to message #6401] Wed, 09 October 2002 19:57 Go to previous messageGo to next message
zapal   Poland
Messages: 68
Registered: October 2002
Location: Poland
Karma: 0
Member
So it must be a bug in non-english themes.

When I switched to default counting was good.
default


2470 Post(s) (9.01 average posts per day)



But see those langs:

default-german


2470 Beiträge (2470 durchschnittliche Beiträge pro Tag)



default-swedish


2470 inlägg (2470 inlägg per dag i medeltal)



default-polish


2470 wiadomo&#347;ci (&#347;rednio 2470 wiadomo&#347;ci dziennie)



Haven't checked other languages.
Re: average counting [message #6404 is a reply to message #6402] Wed, 09 October 2002 20:34 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Congratulations, you've stumbled across a well known bug in PHP that occures becuase PHP does not handle floats & locale appropriately. The reason for the bug is because various locales have different float separators. For example for english locales a separator is '.' but for most European locales the separator is ','. This is a PHP bug, this there is very little FUDforum can do about this.

FUDforum Core Developer
Odp:Re: average counting [message #6420 is a reply to message #6404] Thu, 10 October 2002 07:43 Go to previous messageGo to next message
zapal   Poland
Messages: 68
Registered: October 2002
Location: Poland
Karma: 0
Member
prottoss napisa³(a) dnia ¶ro, 09 pa¼dziernik 2002 10:34

Congratulations, you've stumbled across a well known bug in PHP that occures becuase PHP does not handle floats & locale appropriately.


Thanks for info. I'll check it at php site.

Quote:

This is a PHP bug, this there is very little FUDforum can do about this.


So how about setting LC_NUMERIC to "en" and leaving the rest locales untouched? I know it's not a fix but workaround for this problem, but this bug can be really irritating.
Re: Odp:Re: average counting [message #6427 is a reply to message #6420] Thu, 10 October 2002 13:14 Go to previous message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
I do not intend to hack around PHP bugs. I have already written a patch for PHP that addresses this behaviour. This patch will likely go into version 4.3.0 of PHP.

FUDforum Core Developer
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Group creation problem
Next Topic: avatar upload problem
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 18:50:47 GMT 2024

Total time taken to generate the page: 0.02000 seconds