Several of our users have reported that our Most Active Users box shows innacurate results, with the majority of users being new members with (0) next to their name.Having spent some time on the CS site looking for help, I found a pointer to this stored procdure: cs_system_UpdateMostActiveUsers
From looking at the code, it turns out that Most Active Users is calculated based on the most active users in the last 24 hours, not over a period of time, as our users expected.
By amending this line of the stored procedure, you can adjust what time frame these statistics are calculated over. This can be useful for less active sites, or where you want the statistic to represent your best users over a period of time:
TotalPosts = ISNULL( (SELECT count(PostID) FROM cs_Posts, cs_Sections WHERE cs_Sections.ApplicationType = 0 and cs_Sections.SecitonID = cs_Posts.SectionID and cs_Sections.SettingsID = @SettingsID AND UserID = U.cs_UserID AND PostDate > DateAdd(day, -1, GetDate())),0)
This last section (DateAdd(day, -1, GetDate())),0)), the -1 marks the period of time to go back in calculating the statistics. I have changed our configuiration to -60, but you could equally change this to a longer period of time, although with a large number of posts this might lead to performance problems.
Hi NikW,Thanks for searching the pointer and the stored procedure. I have checked the procedure, too.I don´t understand why there is a "SELECT TOP 100". The Most Active Users displays only the Top 10. That’s why a "SELECT TOP 10" should be enough for performance reasons.If anyone is interested in displaying the "All Time Top10 Users" you can use the following code, which has no timeframe.ALTER procedure [dbo].[cs_system_UpdateMostActiveUsers](@SettingsID int)ASSET Transaction Isolation Level Read UNCOMMITTEDBEGINSET NOCOUNT ON DELETE FROM cs_statistics_User WHERE SettingsID = @SettingsID INSERT INTO cs_statistics_UserSELECT TOP 10U.UserID,U.TotalPosts,@SettingsIDFROMcs_vw_Users_FullUser UWHEREU.IsAnonymous = 0 ANDU.IsIgnored = 0 ANDU.UserAccountStatus = 1 and U.SettingsID = @SettingsIDORDER BYTotalPosts DESC SET NOCOUNT OFFEND Because there is no time dependence there is no calculation. It´s a really simple Select from the View. There can’t be a performance issue. RegardsTorsten
To dig this one back up...
I've got the SDK and have found the above in cs_Site_Statistics.PRC. If I make changes to it, How do I get it into my live site?
Do I recompile the SiteStatistics.cs file in visual basic and then the updated cs_Site_Statisctics will update?
Can anyone give me a simple step by step guide?
You don't need the SDK for this. You need to connect direct to your database (using a tool such as Enterprise Manager, or SQL Management Studio Express) , open up the cs_Site_Statistics sproc, modify it as appropiate and then execute the script to update the sproc on the live database.
For SQL Management Studio Express (download from http://msdn2.microsoft.com/en-gb/express/bb410792.aspx if need be)
Community Server Documentation
Nintendo Wiikly
Could this be adjusted to show... the top posters this month. It'd need to check the current month against the server time and check posts that had been made in that particular month. This would then, in theory, update at the 1st of each month and reset everyone back to 0.
Cheers!
Copyright© 2008 Telligent Systems Inc. All rights reserved CommunityServer.com • Telligent.com