示例#1
0
    def _output(self, sprint, dates, graph_series, graph_end_date):
        # convert all y series to percents
        percent_series = OrderedDict()
        for name, serie in graph_series.items():
            percent_series[name] = serie.get_values_as_percent()

        # add future days (up to graph_end_date) so that the graph looks more realistic
        if len(dates) and sprint.get_zebra_data('end_date') > dates[-1]:
            today = datetime.date.today()
            future_dates = DateHelper.get_future_days(
                sprint.get_zebra_data('end_date'), dates[-1] != today, False)

            for date in future_dates:
                dates.append(date)

        # generate main graph (sprint burnup)
        chart = SprintBurnUpChart.get_chart(dates, percent_series)

        # generate top graphs (result per serie)
        top_graph_series = ['md', 'sp', 'bv']
        result_charts = {}

        for name, serie in graph_series.items():
            if name in top_graph_series:
                result_charts[name] = ResultPerValuePie.get_chart(
                    (serie.get_max_value(), serie.get_commited_value()))

        # collect all needed values for graph output
        args = []
        args.append('{} ({})'.format(
            sprint.get_jira_data('sprint_name').replace('+', ' '),
            sprint.name))
        args.append('Velocity: actual: {:.2f} expected: {:.2f}'.format(
            sprint.get_actual_velocity(), sprint.get_expected_velocity()))
        for name in result_charts:
            serie = graph_series.get(name)
            args.append(
                '{serie_name} {percent:.0f}%<br/>({result:.0f}/{max_value:.0f})'
                .format(
                    serie_name=serie.name.upper(),
                    percent=serie.get_result_as_percent(),
                    result=serie.get_max_value(),
                    max_value=serie.get_commited_value(),
                ))
            args.append(result_charts[name].render(is_unicode=True))
        args.append(chart.render(is_unicode=True))

        # generate the html structure and embed all values
        html_generator = SprintBurnupHtmlOutput(result_charts.keys())
        html = html_generator.get_html_structure().format(*args)

        # write the graph to file
        path = 'sprint_burnup-%s-%s.html' % (UrlHelper.slugify(
            sprint.name), datetime.datetime.now().strftime("%Y%m%d"))
        graph_location = OutputHelper.write_to_file(path, html)
        print 'Your graph is available at %s' % graph_location
示例#2
0
    def _output(self, sprint, dates, graph_series, graph_end_date):
        # convert all y series to percents
        percent_series = OrderedDict()
        for name, serie in graph_series.items():
            percent_series[name] = serie.get_values_as_percent()

        # add future days (up to graph_end_date) so that the graph looks more realistic
        if len(dates) and sprint.get_zebra_data('end_date') > dates[-1]:
            today = datetime.date.today()
            future_dates = DateHelper.get_future_days(sprint.get_zebra_data('end_date'), dates[-1] != today, False)

            for date in future_dates:
                dates.append(date)

        # generate main graph (sprint burnup)
        chart = SprintBurnUpChart.get_chart(dates, percent_series)

        # generate top graphs (result per serie)
        top_graph_series = ['md', 'sp', 'bv']
        result_charts = {}

        for name, serie in graph_series.items():
            if name in top_graph_series:
                result_charts[name] = ResultPerValuePie.get_chart((serie.get_max_value(), serie.get_commited_value()))

        # collect all needed values for graph output
        args = []
        args.append('{} ({})'.format(sprint.get_jira_data('sprint_name').replace('+', ' '), sprint.name))
        args.append(
            'Velocity: actual: {:.2f} expected: {:.2f}'.format(
                sprint.get_actual_velocity(), sprint.get_expected_velocity()
            )
        )
        for name in result_charts:
            serie = graph_series.get(name)
            args.append('{serie_name} {percent:.0f}%<br/>({result:.0f}/{max_value:.0f})'.format(
                serie_name=serie.name.upper(),
                percent=serie.get_result_as_percent(),
                result=serie.get_max_value(),
                max_value=serie.get_commited_value(),
            ))
            args.append(result_charts[name].render(is_unicode=True))
        args.append(chart.render(is_unicode=True))

        # generate the html structure and embed all values
        html_generator = SprintBurnupHtmlOutput(result_charts.keys())
        html = html_generator.get_html_structure().format(*args)

        # write the graph to file
        path = 'sprint_burnup-%s-%s.html' % (
            UrlHelper.slugify(sprint.name),
            datetime.datetime.now().strftime("%Y%m%d")
        )
        graph_location = OutputHelper.write_to_file(path, html)
        print 'Your graph is available at %s' % graph_location
示例#3
0
    def _output(self, sprint_name, story_ids, series, results):
        # generate the graph
        chart = ResultPerStoryChart.get_chart(story_ids, series, results)

        html_generator = HtmlOutput()
        html = html_generator.get_html_structure().format(
            'Result per story', chart.render(is_unicode=True))

        # write the graph to file
        path = 'result_per_story-{}-{}.html'.format(
            UrlHelper.slugify(unicode(sprint_name)),
            datetime.now().strftime("%Y%m%d"))
        graph_location = OutputHelper.write_to_file(path, html)
        print 'Your graph is available at %s' % graph_location
示例#4
0
    def _output(self, sprint_name, story_ids, series, results):
        # generate the graph
        chart = ResultPerStoryChart.get_chart(story_ids, series, results)

        html_generator = HtmlOutput()
        html = html_generator.get_html_structure().format(
            'Result per story',
            chart.render(is_unicode=True)
        )

        # write the graph to file
        path = 'result_per_story-{}-{}.html'.format(
            UrlHelper.slugify(unicode(sprint_name)),
            datetime.now().strftime("%Y%m%d")
        )
        graph_location = OutputHelper.write_to_file(path, html)
        print 'Your graph is available at %s' % graph_location