2011-05-03 08:19:01 +02:00
|
|
|
import datetime
|
|
|
|
|
|
|
|
from optparse import make_option
|
|
|
|
|
|
|
|
from django.core.management.base import BaseCommand, CommandError
|
2012-04-04 17:31:54 +02:00
|
|
|
from djeuscan.models import HerdLog, MaintainerLog, CategoryLog, WorldLog
|
|
|
|
from djeuscan import charts
|
2011-05-03 08:19:01 +02:00
|
|
|
|
|
|
|
class Command(BaseCommand):
|
|
|
|
_overlays = {}
|
|
|
|
help = 'Regenerate rrd database'
|
|
|
|
|
|
|
|
def handle(self, *args, **options):
|
2011-05-05 18:10:47 +02:00
|
|
|
for wlog in WorldLog.objects.all():
|
|
|
|
charts.rrd_update('world', wlog.datetime, wlog)
|
|
|
|
|
2011-05-03 08:19:01 +02:00
|
|
|
for clog in CategoryLog.objects.all():
|
|
|
|
charts.rrd_update('category-%s' % clog.category, clog.datetime, clog)
|
|
|
|
|
|
|
|
for hlog in HerdLog.objects.all():
|
|
|
|
charts.rrd_update('herd-%d' % hlog.herd.id, hlog.datetime, hlog)
|
|
|
|
|
|
|
|
for mlog in MaintainerLog.objects.all():
|
|
|
|
charts.rrd_update('maintainer-%d' % mlog.maintainer.id, mlog.datetime, mlog)
|