Ajay's Creations Support Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Ajax Edit Comments is now subscription based. All support questions need to be directed to http://www.ajaxeditcomments.com/forums/

Pages: [1]   Go Down

Author Topic: Top 10 %dailycount% exceeds %totalcount%  (Read 424 times)

uncajoe

  • Newbie
  • *
  • Offline Offline
  • Posts: 8
    • View Profile
    • Progressive Nation
Top 10 %dailycount% exceeds %totalcount%
« on: February 25, 2010, 01:02:17 PM »

I just installed Top 10 v 1.6.1 and for some reason when the day changed %dailycount% began to exceed %totalcount%. Both counts are still increasing. It appears %dailycount% is now the daily count PLUS the total count. In essence it's adding the daily count to the total count and displaying that total as %dailycount%.

I am using <?php echo_tptn_post_count() ?> to display the code in the page for styling reasons.


The Top 10 format code I'm using is
Code: [Select]
Today&apos;s Views: %dailycount% (All Time: %totalcount%)

which displays as



I only display the counts on single posts. example http://progressivenation.us/2010/02/23/the-non-existent-gop-alternative-health-care-proposal/

Any help will be greatly appreciated.
Logged

uncajoe

  • Newbie
  • *
  • Offline Offline
  • Posts: 8
    • View Profile
    • Progressive Nation
Re: Top 10 %dailycount% exceeds %totalcount%
« Reply #1 on: February 26, 2010, 04:54:10 PM »

I have found some additional information which may be helpful in troubleshooting my problem.

It appears if there is a post revision there is a new row added to the top_ten_daily database. For the above mentioned page in the top_ten_daily database there are 2 different cntaccess entries for the same date for identical amounts.

I am also using the plugin DB Cache Reloaded, Could the caching of Db queries possibly be causing this problem?

I'd also like to know if it's possible to exclude admins and editors in addition to the post authors from being counted.

I have removed the daily count from being displayed until this issue is resolved.
« Last Edit: February 26, 2010, 05:00:06 PM by uncajoe »
Logged

Ajay

  • Administrator
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 596
    • View Profile
    • Ajay - On the Road called Life
Re: Top 10 %dailycount% exceeds %totalcount%
« Reply #2 on: February 26, 2010, 09:46:32 PM »

I wasn't aware of this post revision issue. I'll need to check this detail out more.

I'll take a look at the code of the post count as well to see if there is a problem in this part. Does the automatic part work?

Also, can you try disabling the DB Cache Reloaded and seeing if that fixes the issue.

I like the idea of the admins and editors option too. Let me do some digging on that.

Also, is the daily count, total + daily or is it sum of the individual row entries?
Logged

uncajoe

  • Newbie
  • *
  • Offline Offline
  • Posts: 8
    • View Profile
    • Progressive Nation
Re: Top 10 %dailycount% exceeds %totalcount%
« Reply #3 on: February 27, 2010, 01:18:33 AM »

The daily total seems to be the total + all daily totals for the same post. I did notice that the total count on the admin edit page seem to be correct. This make it even more puzzling. I'll also enable the automatic count display and see if it is working differently.

I will disable the DB Cache plugin as soon as possible to try that but I'm currently under a Digg barrage, which is great for hits ;D but murder on server resources . ::)

Another question - Is there an easy way to get just the total count with a php or js call so I can use the total views count without using the format while using the formatted version other places?
Logged

uncajoe

  • Newbie
  • *
  • Offline Offline
  • Posts: 8
    • View Profile
    • Progressive Nation
Re: Top 10 %dailycount% exceeds %totalcount%
« Reply #4 on: February 27, 2010, 01:29:36 AM »

The Auto output is the same as the function call output. The edit page totals still seem correct.
Post totals (both function and auto) read "Today's Views: 4,035 - Total Views: 4,098" where the edit page total reads "4,098 / 296" for the same post.

I'm stumped.
Logged

uncajoe

  • Newbie
  • *
  • Offline Offline
  • Posts: 8
    • View Profile
    • Progressive Nation
Re: Top 10 %dailycount% exceeds %totalcount%
« Reply #5 on: February 27, 2010, 06:58:42 AM »

I think I've resolved the main issue.

I compared the functions from the top-10/admin.inc.php to top-10-counter.js.php where the daily count was retrieved.

I found one difference -

top-ten-admin.inc.php line 551 - $cntaccess = number_format((($resultscount) ? $resultscount->sumCount : 0));

top-10-counter.js.php line 037 - $cntaccess = number_format((($resultscount) ? $resultscount->sumCount : 1));

Since the count from the top-ten-admin.inc.php seemed right I assumed it was the correct one of the two. I changed the 1 to zero in top-10-counter.js.php and the counts now appear correct.

I'll keep watch for a couple of days and let you know if any other problems arise.


« Last Edit: February 27, 2010, 07:00:17 AM by uncajoe »
Logged

Ajay

  • Administrator
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 596
    • View Profile
    • Ajay - On the Road called Life
Re: Top 10 %dailycount% exceeds %totalcount%
« Reply #6 on: February 27, 2010, 09:59:57 AM »

Wow. I had intentionally made that change in the previous version. Do keep a look and tell me if this resolves the issue.
Logged

uncajoe

  • Newbie
  • *
  • Offline Offline
  • Posts: 8
    • View Profile
    • Progressive Nation
Re: Top 10 %dailycount% exceeds %totalcount%
« Reply #7 on: February 28, 2010, 10:16:42 PM »

It's been two days and the counts seem accurate when compared to my off site stats. They daily count resets at day change. I think that resolved the problem.

I also modified some files to add a simple daily count and total count displays. I needed to have just the raw number, unformatted, to place in certain areas of the html. The php calls are <?php echo_tptn_total_count() ?> and <?php echo_tptn_daily_count() ?>. I've attached the new javascript files(top-10-counter-daily.js.php & top-10-counter-total.js.php) and the modified top-10.php file.

I also attached the  top-10-counter.js.php file with the problem corrected.

Feel free to use these modifications if you think they'll improve your fantastic plugin.
« Last Edit: February 28, 2010, 10:28:00 PM by uncajoe »
Logged

Ajay

  • Administrator
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 596
    • View Profile
    • Ajay - On the Road called Life
Re: Top 10 %dailycount% exceeds %totalcount%
« Reply #8 on: February 28, 2010, 10:32:31 PM »

Thank you. I do have a series of changes planned for the near future. So, will fix this all together.
Logged

uncajoe

  • Newbie
  • *
  • Offline Offline
  • Posts: 8
    • View Profile
    • Progressive Nation
Re: Top 10 %dailycount% exceeds %totalcount%
« Reply #9 on: March 07, 2010, 04:49:18 AM »

I have found a potential fix for another problem, the counting of previews. Just enclose everything below the header in top-10/top-10-addcount.js.php within 
if !is_preview() { .... }
This will bypass adding to the count during preview mode.

I suspect this may be the cause of the extra database entries on daily counts although I will keep a watch on it.
Logged

Ajay

  • Administrator
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 596
    • View Profile
    • Ajay - On the Road called Life
Re: Top 10 %dailycount% exceeds %totalcount%
« Reply #10 on: March 07, 2010, 10:51:42 AM »

I can put that in, but I am not so sure about this being the cause, because it wouldn't be significantly higher right?
Logged

uncajoe

  • Newbie
  • *
  • Offline Offline
  • Posts: 8
    • View Profile
    • Progressive Nation
Re: Top 10 %dailycount% exceeds %totalcount%
« Reply #11 on: March 07, 2010, 02:30:05 PM »

I think it may be adding the extra DB row for the daily count, anytime there are multiple rows for a single post they are always identical in value and the daily total is the total of all rows.

I have found up to 4 different rows for the same post/date. The total count doesn't reflect the extra entries but the daily count does. I have noticed this only seems to occur when I edit a post and use preview.
Logged

Ajay

  • Administrator
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 596
    • View Profile
    • Ajay - On the Road called Life
Re: Top 10 %dailycount% exceeds %totalcount%
« Reply #12 on: March 07, 2010, 02:59:32 PM »

I've taken a look at the code. I will be modifying the code a bit today and running some tests.
Will update this if all goes well.
Logged
Pages: [1]   Go Up