summaryrefslogtreecommitdiff
path: root/roadmap/management/commands/burndown_snapshot.py
blob: 408121a48a68ade3fc8729762214fea4dfe63abb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from optparse import make_option
from roadmap.helpers import collect_burndown, collect_component_burndown
from roadmap.models import Project, CardType

BURNDOWN_PROJECT='project'
BURNDOWN_CARDTYPE='cardtype'

class Command(BaseCommand):
    option_list = BaseCommand.option_list + (
        make_option('--project',
            dest=BURNDOWN_PROJECT,
            action='store',
            type='string',
            help='Project name to create the burndown for',
            default=settings.JIRA_PROJECT
        ),
        make_option('--card-type',
            dest=BURNDOWN_CARDTYPE,
            action='store',
            type='string',
            help='Jira issue type to aggregate the values for',
            default='Blueprint'
        ),
    )
    help = 'Collects the aggregate data to create the burndown bars'

    def handle(self, *args, **options):
        project = Project.objects.get(name=options[BURNDOWN_PROJECT])
        card_type = CardType.objects.get(name=options[BURNDOWN_CARDTYPE])
        collect_burndown(project, card_type)
        collect_component_burndown(project)