- Sprool
- |
- Exalted Legendary Member
- gamertag: [none]
- user homepage:
Best way to do it is do averages. For example, you don't want 200 page loads, so do a maximum of 25, which results in 25*25=625 threads. Each page can then be averaged with the sum to give you a "average replies per page", then extrapolate that to the number of pages in the group.
This can also lead to inaccuracy if you average based on when the group is most popular. Put some distance between the selected pages.
If you are currently doing a simple loop like
for (x = 0; x < pageCount; x++)
turn it into
spacing = pageCount / maxPages
for (x = 0; x < pageCount; x += spacing)
For instance, a group with 200 pages and 25 pages max would need to have a page selected every 8 pages.
spacing = 200 / 25
for (x = 0; x < 200; x += 8) // runs 25 times
But sometimes the spacing will not be a whole number, so:
spacing = Math.floor(pageCount / maxPages)
Posted by: ctjl96
Here, Mushy.
Group Post Calculator CHROME | FIREFOX
This is sort of a pain in the ass to do client-side, because the quickest way (and only one from what I could tell) for you to get the number of posts is to go through every page of the group's forum with ajax and add up the "x replies" and then return it to the user, which can take quite a bit of time, depending on the size of the group. The general rule for this is about a second per page in the forum, so something like Sapphire could take several minutes (I would not know, I've never felt even the slightest inclination to join the occult). Your browser may even tell you that the page is not responding (Chrome says something like "yada this page has died"), but you just have to wait -- it will finish shortly. Due to this complication, you have to click "Calculate" in order for it to tell you the number of posts so that it doesn't take you three minutes to load a group.
I also threw in a quick little PPD calculator along with it. :-)
Note: I'm too lazy to test it for Firefox, but it should work. If there's any bugs, just report 'em here or PM me -- I've been getting lonely anyways.
[Edited on 05.20.2012 7:11 PM PDT]