Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 169200d5ed
Fetching contributors…

Cannot retrieve contributors at this time

19 lines (12 sloc) 0.615 kb
import os
import datetime
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
import settings
from models import Chanstat, Publog
cs = Chanstat.objects.all()
for i in cs:
i.hour = Publog.objects.filter(chan=i.name, tstamp__gte=datetime.datetime.now()-datetime.timedelta(0,3600)).count()
i.day = Publog.objects.filter(chan=i.name, tstamp__gte=datetime.datetime.now()-datetime.timedelta(1)).count()
i.week = Publog.objects.filter(chan=i.name, tstamp__gte=datetime.datetime.now()-datetime.timedelta(7)).count()
i.save()
Publog.objects.filter(tstamp__lt=datetime.datetime.now()-datetime.timedelta(7)).delete()
Jump to Line
Something went wrong with that request. Please try again.