euscan-ng/euscanwww/euscan/management/commands/regen-rrds.py
Corentin Chary 54f7771b43 euscanwww: add new charts
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
2011-05-03 08:19:01 +02:00

22 lines
776 B
Python

import datetime
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from euscanwww.euscan.models import Package, HerdLog, MaintainerLog, CategoryLog, Herd, Maintainer, Version
from euscanwww.euscan import charts
class Command(BaseCommand):
_overlays = {}
help = 'Regenerate rrd database'
def handle(self, *args, **options):
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)