Advertisement:
Advertise With Us!

Author Topic: Exclude boards from statistics?  (Read 3827 times)

Offline KeruS

  • Newbie
  • *
  • Posts: 1
Exclude boards from statistics?
« on: April 25, 2008, 07:51:41 PM »
Is there a way to exclude particular boards from being counted in the forum statistics all together? I can stop the board from counting posts, this reflects in the user's post count but the thread and post counts in statistics still rise.

Offline Oldiesmann

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,830
  • Gender: Male
  • Ask me about the function DB :)
    • oldiesmann on Facebook
    • Oldiesmann on GitHub
    • http://www.linkedin.com/in/michaeleshom on LinkedIn
    • @oldiesmann on Twitter
    • Archie Comics Fan Forum
Re: Exclude boards from statistics?
« Reply #1 on: April 25, 2008, 11:38:50 PM »
There is no way to do this by default in SMF. It can probably be done by tweaking the code some, but I'm not sure how easy it would be to accomplish this. Why wouldn't you want the "Total topics" and "Total posts" to reflect the actual totals anyway?
Michael Eshom

Offline stefann

  • Semi-Newbie
  • *
  • Posts: 54
  • Gender: Male
Re: Exclude boards from statistics?
« Reply #2 on: May 24, 2008, 12:44:15 AM »
I was wondering about this too, but I mainly wanted to exclude a forum from the 'Top 10 Topics (by replies)' as we have some forum games that currently dominate these stats. We don't really want them shown in this section, or really counted in the general statistics totals either. I will most likely hardcode this myself manually later provided it's easy enough, but would be interested to see if anyone else has done similar
full time lurker on freenode #smf

Offline metallica48423

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,842
  • Gender: Male
  • Professional Multislacker!
    • Zentendo
Re: Exclude boards from statistics?
« Reply #3 on: May 25, 2008, 01:17:55 AM »
which sections are you wanting to exclude them from?
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

Quote
Microsoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"

Useful Links:
Online Manual!
How to Help us Help you   
Search
Settings Repair Tool
     

Offline stefann

  • Semi-Newbie
  • *
  • Posts: 54
  • Gender: Male
Re: Exclude boards from statistics?
« Reply #4 on: May 25, 2008, 04:36:17 AM »
I personally only want to remove our 'games' forum from the top 10 topics as the few topics there dwarf the rest of the forum in size, but this is right down the bottom of priorities of my personal little mods. Ideally it'd also be ignored from the general stats and top 10 posters too, but only if it's incredibly easy to do. We DO want to still see it listed in the top 10 boards as we only have 8 public ones as well as the history because our stats are so low anyway.

To implement anything capable of this for the standard release I think would be overkill, and it'd end up as 4 different options for each board to be excluded from General Statistics, Top 10 Boards, Top 10 Posts and/or Forum History individually. I don't know what a 'standard' version could do other than ignore from all 4, or perhaps add a single setting of which of the 4 are ignored globally
full time lurker on freenode #smf

Offline metallica48423

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,842
  • Gender: Male
  • Professional Multislacker!
    • Zentendo
Re: Exclude boards from statistics?
« Reply #5 on: May 25, 2008, 05:06:05 AM »
I actually had an idea for a mod for this exact purpose (removing a board from stats including the latest posts on the board index)

its not that hard to add extra stuff to the where clause of the query.

in /Sources/Stats.php

find
Code: [Select]
        // Topic views top 10.
        $topic_view_result = $smcFunc['db_query']('', '
                SELECT m.subject, t.num_views, t.id_board, t.id_topic, b.name
                FROM {db_prefix}topics AS t
                        INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
                        INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
                        AND b.id_board != {int:recycle_board}' : '') . ')
                WHERE {query_see_board}' . (!empty($topic_ids) ? '
                        AND t.id_topic IN ({array_int:topic_list})' : ($modSettings['postmod_active'] ? '
                        AND t.approved = {int:is_approved}' : '')) . '
                ORDER BY t.num_views DESC
                LIMIT 10',
                array(
                        'topic_list' => $topic_ids,
                        'recycle_board' => $modSettings['recycle_board'],
                        'is_approved' => 1,
                )
        );

Replace:
Code: [Select]
        // Topic views top 10.
        $topic_view_result = $smcFunc['db_query']('', '
                SELECT m.subject, t.num_views, t.id_board, t.id_topic, b.name
                FROM {db_prefix}topics AS t
                        INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
                        INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
                        AND b.id_board != {int:recycle_board}' : '') . ')
                WHERE {query_see_board}' . (!empty($topic_ids) ? '
                        AND t.id_topic IN ({array_int:topic_list})' : ($modSettings['postmod_active'] ? '
                        AND t.approved = {int:is_approved}' : '')) . '
                        AND b.id_board != ###
                ORDER BY t.num_views DESC
                LIMIT 10',
                array(
                        'topic_list' => $topic_ids,
                        'recycle_board' => $modSettings['recycle_board'],
                        'is_approved' => 1,
                )
        );

Find:
Code: [Select]
        // Topic replies top 10.
        $topic_reply_result = $smcFunc['db_query']('', '
                SELECT m.subject, t.num_replies, t.id_board, t.id_topic, b.name
                FROM {db_prefix}topics AS t
                        INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
                        INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
                        AND b.id_board != {int:recycle_board}' : '') . ')
                WHERE {query_see_board}' . (!empty($topic_ids) ? '
                        AND t.id_topic IN ({array_int:topic_list})' : ($modSettings['postmod_active'] ? '
                        AND t.approved = {int:is_approved}' : '')) . '
                ORDER BY t.num_replies DESC
                LIMIT 10',
                array(
                        'topic_list' => $topic_ids,
                        'recycle_board' => $modSettings['recycle_board'],
                        'is_approved' => 1,
                )
        );

Replace:
Code: [Select]
        // Topic replies top 10.
        $topic_reply_result = $smcFunc['db_query']('', '
                SELECT m.subject, t.num_replies, t.id_board, t.id_topic, b.name
                FROM {db_prefix}topics AS t
                        INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
                        INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
                        AND b.id_board != {int:recycle_board}' : '') . ')
                WHERE {query_see_board}' . (!empty($topic_ids) ? '
                        AND t.id_topic IN ({array_int:topic_list})' : ($modSettings['postmod_active'] ? '
                        AND t.approved = {int:is_approved}' : '')) . '
                        AND b.id_board != ###
                ORDER BY t.num_replies DESC
                LIMIT 10',
                array(
                        'topic_list' => $topic_ids,
                        'recycle_board' => $modSettings['recycle_board'],
                        'is_approved' => 1,
                )
        );

Where ### is the ID of the board to leave out in both queries.  If you want to add more boards, just add another "AND b.id_board = ### below the existing one. 

Top 10 posters appears to pull from the data in the members table, rather than doing a COUNT(*) on the messages table, which is logical if you consider that the post count is stored as an integer in that table..  It'd require some potentially heavy sqlwork to remove the top 10 posters' posts in those boards from there.
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

Quote
Microsoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"

Useful Links:
Online Manual!
How to Help us Help you   
Search
Settings Repair Tool
     

Offline stefann

  • Semi-Newbie
  • *
  • Posts: 54
  • Gender: Male
Re: Exclude boards from statistics?
« Reply #6 on: May 25, 2008, 06:03:08 AM »
Thanks for those metallica, I was hoping it would be that easy, and just using the plain member post count achieves exactly the same thing in my case as we don't count posts on that board anyway.

As for a mod, this would probably be a good idea if enough people use it to warrant the time to create it. Given people have to choose to install it having the 4 options per board (or now 3 as adjusting Top 10 Posters wouldn't be worth anyone's time) would be reasonable.
« Last Edit: May 25, 2008, 06:05:21 AM by stefann »
full time lurker on freenode #smf