What's the most efficient way to remember read/unread status across multiple items?
Asked Answered
L

3

2

For example, let's take the format of a forum, where we have multiple users and multiple threads. Say this forum wants to track which users have read which threads and, say, use that information to mark which threads are unread when viewing the thread list.

The only solution I can imagine is something that drops a record into the database each time a user visits a thread. I suppose there could be a 'mark all as read' button, which could employ a time stamp to help lessen the sprawl in the database... regardless this isn't a solution that impresses me.

I have a feeling that I'm missing something here... maybe Thanksgiving morning isn't the time to think over one's programming problems.

Is there a better solution out there for this? Any ideas?

Lull answered 27/11, 2008 at 13:23 Comment(0)
C
1
  1. Drop a record in the database for each user-thread combination
  2. Or store this information in a file - one file per user. It may need to be locked/unlocked in case multiple logins by the same user are allowed.
Covariance answered 27/11, 2008 at 13:28 Comment(0)
T
3

Using a database record sounds like the most promising to me. It will generate a table with millions of rows very quickly if you have an active forum but it would be the simplest solution to implement. It will give a lot of flexibility for querying which users are reading what too.

Trifurcate answered 27/11, 2008 at 13:31 Comment(0)
C
1
  1. Drop a record in the database for each user-thread combination
  2. Or store this information in a file - one file per user. It may need to be locked/unlocked in case multiple logins by the same user are allowed.
Covariance answered 27/11, 2008 at 13:28 Comment(0)
V
0

I think I saw somewhere, maybe phpbb forum? anyway

there was a table in it with userid, threadid, last-read-datetime (let name it userAsRead)

then it would compare the last post made in that threadid vs last-read-datetime

for the mark as all read, it was a field in the usertable using the same logic as above

don't forget to clear the userAsRead if "mark as all read" is used, would save DB space

Venial answered 27/11, 2008 at 13:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.