View Single Post
  #5 (permalink)  
Old August 2nd, 2007, 04:46 AM
jimibt jimibt is offline
Friend of Wrox
 
Join Date: Mar 2007
Location: Creetown, UK
Posts: 488
Thanks: 2
Thanked 11 Times in 10 Posts
Default

As some may be aware, i made a few amendments to the forums stuff earlier this year and posted the code for all to use. After reviewing this post, looks like i missed a little trick. THe idea for last visited is a nice one and i might pull down a fresh copy of TBH, implement my existing changes and add this new functionality. Before doing so tho', i thought i'd ask if anyone has already done this as i don't wish to reinvent the wheel. My idea was going to be very similar to max's but work as follows:

1. Create a user table for post views 'UserPostViews' with fields 'UserID, ParentPostID, LastPostDate'
2. Only add an entry when the user views a thread (this entry being the LastPostDate on the thread [as well the the UserID and ParentPostID of course]).
3. when a new post is added to a thread, do a delete across the UserPostViews where the ParentPostID equals that of the thread. This is mainly to keep the size of the recordset in UserPostViews to a bare minimum.
4. when querying the BrowseThreads page, the DAL would have an outer join (or more likely, an correlated update as there is already a tmp table being created in the sql - whichever was most efficient) onto the UserPostViews table. This would add a value to a virtual column called 'IsNew'.
5. when displaying the results in BrowseThreads.aspx, show the appropriate icon in the gridview to indicate that the last post is new.

Really, that was the extent of it. I know it's somewhat simplistic, but for my purposes, i think it's fine. So if anyone has another implementation before i head down this path, please let me know.

The only 'main' concern is the fact that the cached data for the threads would now be somewhat comprimised, so perhaps the userpostviews table would have to be brought in seperately against the user querying the forum thread. hmmm, lots to think about before rushing in.

[edit] just thinking out loud here. probably i don't need the lastpostdate column as the presence or absence of the row is actually enough. still wondering if there's an 'interim' use for the date column before removing it from the definition.

jimi

http://www.jamestollan.com