Makeshift Counters for Stories
|
|
By Defect , Section Wishlist [] Posted on Fri Nov 02, 2001 at 12:00:00 PM PST
|
|
Now that scoop tracks registered users and which stories they've accessed recently with the viewed_stories table, then it would take very little effort to use that data as a sort of counter for how many views stories have gotten. This would only count how many registered users have visited a story, but it's better than nothing, and maybe could be visible only to the author and admins as just to squelch a simple curiousity.
|
If i understand correctly, and i very well might not as i'm only looking at the db structure and haven't actually played with scoop in well over 6 months, then you'd just need to query 'select count(uid) from viewed_stories where sid=$story_sid' and you've got a simple running count of the how many users have checked out a story.
It wouldn't serve much use for everyone to see that information, which is why i suggested it be available to authors and admins only. And on that note, i think authors should be able to see more information about the stories they post anyway, be it who voted what or at least stats on votes, and, well, i can't think of anything else but surely there must be some information that authors might like to know.
pseudo code for my idea follows just because i'm bored:
if($this_uid==$authors_uid or u_b_an_admin){
($rv,$sth)=db_select({
what => 'count(uid)',
from => 'viewed_stories',
where => "sid=$this_sid"});
$num_views=$sth->fetchrow(); # and there you go
$sth->finish();
}
easy as pie. whatever that means. |
|
Story Views
|
40 Scoop users have viewed this story.
|
|