Well, if I were doing it by hand, every time they came to the site I 
would set this_visit, and then set last_visit (or last_seen, or 
whatever) to the previous value of this_visit, and I would only do it 
once, when they first come to the site.

Problem is two-fold..
1) I don't have a central point to route them through to do this one 
time only, and
2) when I've tried the this_visit/last_visit swap, I got errors (key 
errors, as I recall)


On Jan 30, 11:16 am, "Chris Brand" <[EMAIL PROTECTED]> wrote:
> > > The problem is that it resets when the visitor first comes to the page.
> > > In other words, when I go to the site first thing in the morning
> > > last_seen resets to NOW.But that's exactly what your code says :
>
> > >             l = request.session['last_seen']
> > >             last = now -l
> > >             # don't update it too often, every 4 hours should be ok
> > >             if last.seconds > (60 * 60 * 4):
> > >                 request.session['last_seen']  =
> > > datetime.datetime.now()i.e. If it's more than 4 hours after the 
> > > "last_seen" time, change the "last
> seen" time to "now".
>
> I think you need to think about your algorithm. Ignore the code for now -
> how would you do this by hand ?
>
> Chris


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to