示例#1
0
    def _chapter_helpdesk(self, chapter):
        print('------>', chapter.name)
        wb = self.workbook
        ws = wb.add_worksheet('{} Chapter'.format(chapter.name))
        deck = ChapterDeck(chapter, *Data.getChapterHelpDesk(chapter.name))
        reporter = TechChapterReporter(chapter,
                                       deck,
                                       start=self.start,
                                       end=self.end)
        painter = Painter(wb, ws)
        ws.set_zoom(80)
        ws.set_column(0, 0, 30)
        ws.set_column(1, 1, 122)
        ws.set_column(2, 5, 20)
        row, col = 0, 0

        _heading = self.workbook.add_format({
            'bold': True,
            'font_size': 30,
            'bg_color': '#002D67',
            'font_color': '#FFE616',
            'align': 'center'
        })

        ws.merge_range(xl_range(row, 0, row, 3),
                       "Help Desk for Chapter: '{0}'".format(chapter.name),
                       _heading)

        ws.set_row(0, 42)
        ws.insert_image(0, 0, settings.logofiware, {
            'x_scale': 0.5,
            'y_scale': 0.5,
            'x_offset': 0,
            'y_offset': 0
        })

        row += 1
        ws.write(row, 0, 'Project Time:', self.spFormats.bold_right)
        ws.write(row, 1, '{}'.format(agileCalendar.projectTime()))

        ws.write(row, 2, 'Report Date:', self.spFormats.bold_right)
        ws.write(row, 3, date.today().strftime('%d-%m-%Y'))

        row += 1
        ws.write(row, 0, 'Start of Data Analysis:', self.spFormats.bold_right)
        ws.write(
            row, 1,
            '{}'.format(agileCalendar.projectTime(current_date=self.start)))

        row += 1
        ws.write(row, 0, 'End of Data Analysis:', self.spFormats.bold_right)
        ws.write(row, 1,
                 '{}'.format(agileCalendar.projectTime(current_date=self.end)))

        row += 2
        _format = self.workbook.add_format({
            'bold': True,
            'font_size': 15,
            'color': 'green'
        })
        ws.write(row, 0, 'Chapter Name:', self.spFormats.bold_right)
        ws.write(row, 1, chapter.Name, _format)
        row += 1
        _format = self.workbook.add_format({
            'bold': True,
            'font_size': 15,
            'bg_color': '#60C1CF'
        })
        ws.write(row, 0, 'Chapter Leader:', self.spFormats.bold_right)
        ws.write(row, 1, chapter.leader, _format)
        ws.write(row, 2, '', _format)
        if chapter.architect:
            row += 1
            ws.write(row, 0, 'Chapter Architect:', self.spFormats.bold_right)
            ws.write(row, 1, chapter.architect, _format)
            ws.write(row, 2, '', _format)
        row += 2

        ws.write(row, 0, 'HelpDesk Summary:', self.spFormats.bold_right)
        ws.write(row, 1, '# Items', self.spFormats.bold_left)

        row += 1
        data = deck.issueType
        ws.write(row, 0, 'Composition', self.spFormats.bold_right)
        ws.write(
            row, 1, '{0:,} Issues = {extRequest} extRequests + '
            '{Monitor:,} Monitors'.format(sum(data.values()), **data))

        row += 1
        data = deck.status
        ws.write(row, 0, 'Status', self.spFormats.bold_right)
        ws.write(
            row, 1,
            '{0:,} Issues = {Open} Open + {In Progress} In Progress + {Impeded} Impeded + {Answered} Answered +'
            ' {Closed} Closed'.format(sum(data.values()), **data))

        row += 1
        data = deck.resolution
        ws.write(row, 0, 'Resolved', self.spFormats.bold_right)
        fields = ' + '.join([
            '{' + '{0}'.format(item) + '} ' + '{0}'.format(item)
            for item in data
        ])
        ws.write(
            row, 1, '{0:,} Issues = '.format(sum(data.values())) +
            fields.format(**data))

        if len(deck):
            row += 2
            chart = painter.draw_composition(deck.issueType)
            ws.insert_chart(row, 1, chart, {'x_offset': 0, 'y_offset': 0})

            chart = painter.draw_status(deck.status)
            ws.insert_chart(row, 1, chart, {'x_offset': 250, 'y_offset': 0})

            chart = painter.draw_resolution(deck.resolution)
            ws.insert_chart(row, 1, chart, {'x_offset': 550, 'y_offset': 0})

            row += 17
        ws.write(row, 0, 'HelpDesk Set:', self.spFormats.bold_right)
        ws.write(row, 1, 'Statistics', self.spFormats.bold_left)

        row += 1
        ws.write(row, 0, 'All:', self.spFormats.bold_right)
        self._write_stats(ws, row, reporter.stats)

        if reporter.stats['n'] > 0:
            row += 1
            ws.write(row, 0, 'Last 60 days:', self.spFormats.bold_right)
            self._write_stats(ws, row, reporter.statsOfRecent)

            row += 1
            ws.write(row, 0, 'Pending Issues:', self.spFormats.bold_right)
            self._write_stats(ws, row, reporter.statsOfPending)
        if len(deck):
            row += 1
            chart = painter.draw_resolution_time(
                reporter.resolutionTime_graph_data)
            ws.insert_chart(row, 1, chart, {'x_offset': 0, 'y_offset': 0})

            row += 15
            chart = painter.draw_evolution(reporter.evolution_graph_data)
            ws.insert_chart(row, 1, chart, {'x_offset': 0, 'y_offset': 0})

            row += 15
        row += 1
        _format = self.workbook.add_format({
            'bold': True,
            'font_size': 16,
            'bg_color': '#009999'
        })

        row += 1
        ws.merge_range(xl_range(row, 1, row, 2),
                       'Enablers Contribution and Service Time', _format)

        row += 1
        chart = painter.draw_enablers_contribution(reporter.enablers)
        ws.insert_chart(row, 1, chart, {'x_offset': 0, 'y_offset': 0})

        chart = painter.draw_enablers_service_time(reporter.enablers)
        ws.insert_chart(row, 1, chart, {'x_offset': 500, 'y_offset': 0})
示例#2
0
    def _node_helpdesk(self, node):
        print('--------->', node.name)
        wb = self.workbook
        ws = wb.add_worksheet(node.name)
        deck = LabDeck(node, self.data, self.timestamp, self.source)
        # reporter = self.reporter

        painter = Painter(wb, ws)
        ws.set_zoom(80)
        ws.set_column(0, 0, 20)
        ws.set_column(1, 1, 20)
        ws.set_column(2, 2, 122)
        ws.set_column(3, 5, 25)
        row, col = 0, 0

        _heading = self.workbook.add_format({
            'bold': True,
            'font_size': 30,
            'bg_color': '#002D67',
            'font_color': '#FFE616',
            'align': 'center'
        })

        ws.merge_range(xl_range(row, 0, row, 4),
                       "Help Desk for Node: '{0}'".format(node.name), _heading)

        ws.set_row(0, 42)
        ws.insert_image(0, 0, settings.logofiware, {
            'x_scale': 0.5,
            'y_scale': 0.5,
            'x_offset': 0,
            'y_offset': 0
        })

        row += 1
        ws.write(row, 0, 'Project Time:', self.spFormats.bold_right)
        ws.write(row, 1, '{}'.format(agileCalendar.projectTime()))

        ws.write(row, 3, 'Report Date:', self.spFormats.bold_right)
        ws.write(row, 4, date.today().strftime('%d-%m-%Y'))

        row += 1
        ws.write(row, 0, 'Start of Data Analysis:', self.spFormats.bold_right)
        ws.write(
            row, 1,
            '{}'.format(agileCalendar.projectTime(current_date=self.start)))

        row += 1
        ws.write(row, 0, 'End of Data Analysis:', self.spFormats.bold_right)
        ws.write(row, 1,
                 '{}'.format(agileCalendar.projectTime(current_date=self.end)))

        row += 2
        _format = self.workbook.add_format({
            'bold': True,
            'font_size': 15,
            'color': 'green'
        })
        ws.write(row, 0, 'Node:', self.spFormats.bold_right)
        ws.write(row, 1, node.name, _format)

        row += 1
        ws.write(row, 0, 'Work Mode:', self.spFormats.bold_right)
        try:
            ws.write(row, 1, deck.node.mode)
        except Exception:
            # there is no data about the node, therefore we consider the node Inactive
            ws.write(row, 1, 'Inactive')

        row += 2
        ws.write(row, 0, 'HelpDesk Summary:', self.spFormats.bold_right)
        ws.write(row, 1, '# Items', self.spFormats.bold_left)

        row += 1
        reporter = DeckReporter(node.name,
                                deck,
                                start=self.start,
                                end=self.end)
        reporter.deck = deck
        ws.write(row, 0, 'Composition', self.spFormats.bold_right)
        ws.write(
            row, 1, '{} Issues = {} extRequests + {} Monitors'.format(
                len(deck), deck.issueType['extRequest'],
                deck.issueType['Monitor']))

        row += 1
        ws.write(row, 0, 'Status', self.spFormats.bold_right)
        ws.write(
            row, 1,
            '{} Issues = {} Open + {} In Progress + {} Impeded + {} Answered + {} Closed'
            .format(len(deck), deck.status['Open'], deck.status['In Progress'],
                    deck.status['Impeded'], deck.status['Answered'],
                    deck.status['Closed']))

        if len(reporter.deck):
            row += 2
            chart = painter.draw_composition(reporter.deck.issueType)
            ws.insert_chart(row, 1, chart, {'x_offset': 0, 'y_offset': 0})

            chart = painter.draw_status(reporter.deck.status)
            ws.insert_chart(row, 1, chart, {'x_offset': 250, 'y_offset': 0})

            chart = painter.draw_resolution(reporter.deck.resolution)
            ws.insert_chart(row, 1, chart, {'x_offset': 550, 'y_offset': 0})

            row += 15

        row += 2
        ws.write(row, 0, 'HelpDesk Set:', self.spFormats.bold_right)
        ws.write(row, 1, 'Statistics', self.spFormats.bold_left)

        row += 1
        ws.write(row, 0, 'All:', self.spFormats.bold_right)
        self._write_stats(ws, row, reporter.stats)

        if reporter.stats['n'] > 0:
            row += 1
            ws.write(row, 0, 'Pending Issues:', self.spFormats.bold_right)
            self._write_stats(ws, row, reporter.statsOfPending)

        if len(reporter.deck):
            row += 1
            chart = painter.draw_resolution_time(
                reporter.resolutionTime_graph_data)
            ws.insert_chart(row, 1, chart, {'x_offset': 0, 'y_offset': 0})

            row += 15
            chart = painter.draw_evolution(reporter.evolution_graph_data)
            ws.insert_chart(row, 1, chart, {'x_offset': 0, 'y_offset': 0})

            row += 15

        row += 1
        _format = self.workbook.add_format({
            'bold': True,
            'font_size': 16,
            'bg_color': '#009999'
        })

        row += 1
        _format = self.workbook.add_format({
            'bold': True,
            'font_size': 20,
            'bg_color': '#3399FF',
            'align': 'center'
        })
        ws.merge_range(xl_range(row, 0, row, 4), 'Help Desk Entries', _format)
        ws.write(
            row + 1, 1,
            'No entries found for this enabler in the Tech channel of the Help Desk'
        )

        _center = self.workbook.add_format({'align': 'center'})

        if len(reporter.deck.unresolved):
            row += 1
            _format = self.workbook.add_format({
                'bold': True,
                'font_size': 20,
                'bg_color': '#CCFFE5',
                'align': 'center'
            })

            ws.merge_range(xl_range(row, 0, row, 4), 'Unresolved Issues',
                           _format)
            row += 1
            ws.write_row(
                row, 0,
                ('Item Id', 'Channel', 'Summary', 'Status', 'Age (#days)'),
                self.spFormats.column_heading)

            for issue in reporter.deck.unresolved:
                row += 1
                ws.write_url(row, 0, issue.url, self.spFormats.link, issue.key)
                ws.write(row, 1, issue.channel.name)
                ws.write(row, 2, issue.name)
                ws.write(row, 3, issue.status)
                ws.write(row, 4, issue.age, _center)
            else:
                ws.write(
                    row + 1, 0, '>>>>> {} issues found'.format(
                        len(reporter.deck.unresolved)))
            row += 1

        if len(reporter.deck.resolved):
            row += 1
            _format = self.workbook.add_format({
                'bold': True,
                'font_size': 20,
                'bg_color': '#CCFFE5',
                'align': 'center'
            })

            ws.merge_range(xl_range(row, 0, row, 4), 'Resolved Issues',
                           _format)
            row += 1
            ws.write_row(row, 0, ('Resolution Date', 'Item Id', 'Summary',
                                  'Status-Resolution', 'Age (#days)'),
                         self.spFormats.column_heading)

            for issue in reporter.deck.resolved:
                row += 1
                ws.write(row, 0, issue.resolutionDate, self.spFormats.date)
                ws.write_url(row, 1, issue.url, self.spFormats.link, issue.key)
                ws.write(row, 2, issue.name)
                ws.write(row, 3, '{0} - {1}'.format(issue.status,
                                                    issue.resolution))
                ws.write(row, 4, issue.age, _center)
            else:
                ws.write(
                    row + 1, 0, '>>>>> {} issues found'.format(
                        len(reporter.deck.resolved)))
示例#3
0
    def _coordination_helpdesk(self, coordination):
        wb = self.workbook
        ws = wb.add_worksheet(coordination.name[1:])
        backlog = self.factory.getCoordinationBacklog(coordination.key)
        backlog.sort(key=backlog.sortDict['name'])

        painter = Painter(wb, ws)
        ws.set_zoom(80)
        ws.set_column(0, 0, 30)
        ws.set_column(1, 1, 122)
        ws.set_column(2, 5, 20)
        row, col = 0, 0
        _heading = self.workbook.add_format({
            'bold': True,
            'font_size': 30,
            'bg_color': '#002D67',
            'font_color': '#FFE616',
            'align': 'center'
        })

        ws.merge_range(xl_range(row, 0, row, 3), "Coordination Backlog",
                       _heading)
        ws.set_row(0, 42)
        ws.insert_image(0, 0, settings.logofiware, {
            'x_scale': 0.5,
            'y_scale': 0.5,
            'x_offset': 0,
            'y_offset': 0
        })

        row += 1
        ws.write(row, 0, 'Project Time:', self.spFormats.bold_right)
        ws.write(row, 1, '{}'.format(agileCalendar.projectTime()))

        ws.write(row, 2, 'Report Date:', self.spFormats.bold_right)
        ws.write(row, 3, date.today().strftime('%d-%m-%Y'))

        row += 1
        ws.write(row, 0, 'Start of Data Analysis:', self.spFormats.bold_right)
        ws.write(
            row, 1,
            '{}'.format(agileCalendar.projectTime(current_date=self.start)))

        row += 1
        ws.write(row, 0, 'End of Data Analysis:', self.spFormats.bold_right)
        ws.write(row, 1,
                 '{}'.format(agileCalendar.projectTime(current_date=self.end)))

        row += 2
        _format = self.workbook.add_format({
            'bold': True,
            'font_size': 15,
            'bg_color': '#60C1CF'
        })
        ws.write(row, 0, 'Backlog Owner:', self.spFormats.bold_right)
        ws.write(row, 1, coordination.leader, _format)
        ws.write(row, 2, '', _format)

        row += 2
        ws.write(row, 0, 'Backlog Summary:', self.spFormats.bold_right)
        ws.write(row, 1, '# Items', self.spFormats.bold_left)

        row += 1
        reporter = CoordinationReporter(coordination.project, backlog)
        data = reporter.issueType
        ws.write(row, 0, 'Composition', self.spFormats.bold_right)
        ws.write(
            row, 1, '{0} Issues = {Epic} Epics + {Feature} Features + '
            '{Story} User Stories + {WorkItem} WorkItems + {Bug} Bugs'.format(
                sum(data.values()), **data))

        row += 1
        data = reporter.perspective
        ws.write(row, 0, 'Status', self.spFormats.bold_right)
        ws.write(
            row, 1,
            '{0} Issues = {Implemented} Implemented  + {Working On} Working On  + '
            ' {Foreseen} Foreseen'.format(sum(data.values()), **data))

        row += 1
        data = reporter.sprint_status
        ws.write(row, 0, 'Sprint Status', self.spFormats.red_bold_right)
        ws.write_string(
            row, 1, '{} Issues = {}'.format(
                sum(data.values()),
                ' + '.join("{!s} {}".format(v, k) for (k, v) in data.items())))

        row += 1
        ws.write(row, 0, 'Tests', self.spFormats.bold_right)
        data = reporter.backlog.testMetrics
        total = sum(data['OK'].values()) + sum(data['KO'].values())
        ws.write_rich_string(
            row, 1, '{0:,} Tests = {1:,}'.format(total,
                                                 sum(data['OK'].values())),
            self.spFormats.green, ' OK', ' + ',
            '{0:,}'.format(sum(data['KO'].values())), self.spFormats.red,
            ' KO ')

        row += 1
        data = reporter.errors
        ws.write(row, 0, 'Errors', self.spFormats.bold_right)
        ws.write_rich_string(
            row, 1, '{:,} Issues = {OK:,}'.format(sum(data.values()), **data),
            self.spFormats.green, ' OK', ' + '
            ' {KO:,}'.format(sum(data.values()),
                             **data), self.spFormats.red, ' KO')

        row += 2
        chart = painter.draw_composition(reporter.issueType)
        ws.insert_chart(row, 1, chart, {'x_offset': 0, 'y_offset': 0})

        chart = painter.draw_status(reporter.perspective)
        ws.insert_chart(row, 1, chart, {'x_offset': 300, 'y_offset': 0})

        chart = painter.draw_errors(reporter.errors)
        ws.insert_chart(row, 1, chart, {'x_offset': 712, 'y_offset': 0})

        row += 15
        chart = painter.draw_sprint_burndown(reporter.burndown)
        ws.insert_chart(row, 1, chart, {'x_offset': 0, 'y_offset': 0})

        chart = painter.draw_sprint_status(reporter.sprint_status)
        ws.insert_chart(row, 1, chart, {'x_offset': 712, 'y_offset': 0})

        row += 15
        chart = painter.draw_evolution(reporter.implemented)
        ws.insert_chart(row, 1, chart, {'x_offset': 0, 'y_offset': 0})

        row += 15
        _format = self.workbook.add_format({
            'bold': True,
            'font_size': 20,
            'bg_color': '#60C1CF',
            'align': 'center'
        })
        ws.merge_range(xl_range(row, 0, row, 4), 'Backlog Entries', _format)
        row += 1

        ws.write_row(
            row, 0,
            ('Item Id', 'Item reference', 'Time frame', 'Status', 'Item type'),
            self.spFormats.column_heading)

        for issue in backlog:
            row += 1
            self._write_issue(ws, row, issue)
示例#4
0
    def _lab_channel_help_desk(self):
        print('---> Lab Nodes')
        wb = self.workbook
        ws = wb.add_worksheet('Lab Channel')
        deck = self.deck
        reporter = self.reporter

        painter = Painter(wb, ws)
        ws.set_zoom(80)
        ws.set_column(0, 0, 30)
        ws.set_column(1, 1, 122)
        ws.set_column(2, 5, 20)
        row, col = 0, 0

        _heading = self.workbook.add_format({
            'bold': True,
            'font_size': 30,
            'bg_color': '#002D67',
            'font_color': '#FFE616',
            'align': 'center'
        })

        ws.merge_range(xl_range(row, 0, row, 3),
                       "Help Desk for Technical Chapters", _heading)

        ws.set_row(0, 42)
        ws.insert_image(0, 0, settings.logofiware, {
            'x_scale': 0.5,
            'y_scale': 0.5,
            'x_offset': 0,
            'y_offset': 0
        })

        row += 1
        ws.write(row, 0, 'Project Time:', self.spFormats.bold_right)
        ws.write(row, 1, '{}'.format(agileCalendar.projectTime()))

        ws.write(row, 2, 'Report Date:', self.spFormats.bold_right)
        ws.write(row, 3, date.today().strftime('%d-%m-%Y'))

        row += 1
        ws.write(row, 0, 'Start of Data Analysis:', self.spFormats.bold_right)
        ws.write(
            row, 1,
            '{}'.format(agileCalendar.projectTime(current_date=self.start)))

        row += 1
        ws.write(row, 0, 'End of Data Analysis:', self.spFormats.bold_right)
        ws.write(row, 1,
                 '{}'.format(agileCalendar.projectTime(current_date=self.end)))

        row += 2
        _format = self.workbook.add_format({
            'bold': True,
            'font_size': 15,
            'bg_color': '#60C1CF'
        })
        ws.write(row, 0, 'Tech Channel Leader:', self.spFormats.bold_right)
        ws.write(row, 1, 'FF - Veronika Vlnkova', _format)
        ws.write(row, 2, '', _format)

        row += 2
        ws.write(row, 0, 'Tech Channel Summary', self.spFormats.bold_right)
        ws.write(row, 1, '# Items', self.spFormats.bold_left)

        row += 1
        reporter.deck = deck
        data = reporter.deck.issueType
        ws.write(row, 0, 'Composition', self.spFormats.bold_right)
        ws.write(
            row, 1, '{0:,} Issues = {extRequest} extRequests + '
            '{Monitor:,} Monitors'.format(sum(data.values()), **data))

        row += 1
        data = reporter.deck.status
        ws.write(row, 0, 'Status', self.spFormats.bold_right)
        ws.write(
            row, 1,
            '{0:,} Issues = {Open} Open + {In Progress} In Progress + {Impeded} Impeded + {Answered} Answered +'
            ' {Closed} Closed'.format(sum(data.values()), **data))

        row += 1
        data = reporter.deck.resolution
        ws.write(row, 0, 'Resolved', self.spFormats.bold_right)
        fields = ' + '.join([
            '{' + '{0}'.format(item) + '} ' + '{0}'.format(item)
            for item in data
        ])
        ws.write(
            row, 1, '{0:,} Issues = '.format(sum(data.values())) +
            fields.format(**data))

        if len(reporter.deck):
            row += 2
            chart = painter.draw_composition(reporter.deck.issueType)
            ws.insert_chart(row, 1, chart, {'x_offset': 0, 'y_offset': 0})

            chart = painter.draw_status(reporter.deck.status)
            ws.insert_chart(row, 1, chart, {'x_offset': 250, 'y_offset': 0})

            chart = painter.draw_resolution(reporter.deck.resolution)
            ws.insert_chart(row, 1, chart, {'x_offset': 550, 'y_offset': 0})

            row += 17

        ws.write(row, 0, 'Channel Set:', self.spFormats.bold_right)
        ws.write(row, 1, 'Statistics', self.spFormats.bold_left)

        row += 1
        ws.write(row, 0, 'All:', self.spFormats.bold_right)
        self._write_stats(ws, row, reporter.stats)

        if reporter.stats['n'] > 0:
            row += 1
            ws.write(row, 0, 'Pending Issues:', self.spFormats.bold_right)
            self._write_stats(ws, row, reporter.statsOfPending)

        if len(reporter.deck):
            row += 1
            chart = painter.draw_resolution_time(
                reporter.resolutionTime_graph_data)
            ws.insert_chart(row, 1, chart, {'x_offset': 0, 'y_offset': 0})

            row += 15
            chart = painter.draw_evolution(reporter.evolution_graph_data)
            ws.insert_chart(row, 1, chart, {'x_offset': 0, 'y_offset': 0})

            row += 15

        row += 1
        _format = self.workbook.add_format({
            'bold': True,
            'font_size': 13,
            'bg_color': '#D0E799'
        })
        ws.merge_range(xl_range(row, 1, row, 2),
                       'Nodes Contribution and Service Time', _format)

        row += 1
        chart = painter.draw_nodes_contribution(reporter.nodes)
        ws.insert_chart(row, 1, chart, {'x_offset': 0, 'y_offset': 0})

        chart = painter.draw_nodes_service_time(reporter.nodes)
        ws.insert_chart(row, 1, chart, {'x_offset': 500, 'y_offset': 0})
示例#5
0
    def _enabler_helpdesk(self, enabler):
        print('--------->', enabler.name)
        wb = self.workbook
        ws = wb.add_worksheet(enabler.name)
        deck = EnablerDeck(enabler, *Data.getEnablerHelpDesk(enabler.name))

        painter = Painter(wb, ws)
        ws.set_zoom(80)
        ws.set_column(0, 0, 20)
        ws.set_column(1, 1, 20)
        ws.set_column(2, 2, 122)
        ws.set_column(3, 5, 25)
        row, col = 0, 0

        _heading = self.workbook.add_format({'bold': True, 'font_size': 30,
                                            'bg_color': '#002D67', 'font_color': '#FFE616', 'align': 'center'})

        ws.merge_range(xl_range(row, 0, row, 4),
                       "Help desk for Enabler: '{0}'".format(enabler.name), _heading)
        ws.set_row(0, 42)
        ws.insert_image(0, 0, settings.logofiware, {'x_scale': 0.5, 'y_scale': 0.5, 'x_offset': 0, 'y_offset': 0})

        row += 1
        ws.write(row, 0, 'Project Time:', self.spFormats.bold_right)
        ws.write(row, 1, '{}'.format(agileCalendar.projectTime()))

        ws.write(row, 3, 'Report Date:', self.spFormats.bold_right)
        ws.write(row, 4, date.today().strftime('%d-%m-%Y'))

        row += 1
        ws.write(row, 0, 'Start of Data Analysis:', self.spFormats.bold_right)
        ws.write(row, 1, '{}'.format(agileCalendar.projectTime(current_date=self.start)))

        row += 1
        ws.write(row, 0, 'End of Data Analysis:', self.spFormats.bold_right)
        ws.write(row, 1, '{}'.format(agileCalendar.projectTime(current_date=self.end)))

        #
        row += 2
        _format = self.workbook.add_format({'bold': True, 'font_size': 15, 'color': 'green'})
        ename = enabler.Name if enabler.GE else enabler.name
        ws.write(row, 0, 'Enabler:', self.spFormats.bold_right)
        ws.write(row, 1, ename, _format)
        row += 1
        _format = self.workbook.add_format({'bold': True, 'font_size': 15, 'bg_color': '#60C1CF'})
        ws.write(row, 0, 'Product Owner:', self.spFormats.bold_right)
        ws.write(row, 1, '{} - {}'.format(enabler.owner, enabler.leader), _format)
        ws.write_row(row, 2, ('', '', ''), _format)

        row += 1
        ws.write(row, 0, 'Work Mode:', self.spFormats.bold_right)
        ws.write(row, 1, enabler.mode)

        row += 2
        ws.write(row, 0, 'HelpDesk Summary:', self.spFormats.bold_right)
        ws.write(row, 1, '# Items', self.spFormats.bold_left)
        #
        row += 1

        reporter = DeckReporter(enabler.name, deck, start=self.start, end=self.end)
        reporter.deck = deck
        data = reporter.deck.issueType
        ws.write(row, 0, 'Composition', self.spFormats.bold_right)
        ws.write(row, 1, '{0:,} Issues = {extRequest} extRequests + {Monitor:,} Monitors'
                 .format(sum(data.values()), **data))

        row += 1
        data = reporter.deck.status
        ws.write(row, 0, 'Status', self.spFormats.bold_right)
        ws.write(row, 1,
                 '{0:,} Issues = {Open} Open + {In Progress} In Progress + {Impeded} Impeded + {Answered} Answered +'
                 ' {Closed} Closed'.format(sum(data.values()), **data))

        row += 1
        data = reporter.deck.resolution
        ws.write(row, 0, 'Resolved', self.spFormats.bold_right)
        fields = ' + '.join(['{' + '{0}'.format(item) + '} ' + '{0}'.format(item) for item in data])

        if len(data):
            ws.write(row, 1, '{0:,} Issues = '.format(sum(data.values())) + fields.format(**data))
        else:
            ws.write(row, 1, '0 Issues')

        if len(reporter.deck):
            row += 2
            chart = painter.draw_composition(reporter.deck.issueType)
            ws.insert_chart(row, 1, chart, {'x_offset': 0, 'y_offset': 0})

            chart = painter.draw_status(reporter.deck.status)
            ws.insert_chart(row, 1, chart, {'x_offset': 250, 'y_offset': 0})

            chart = painter.draw_resolution(reporter.deck.resolution)
            ws.insert_chart(row, 1, chart, {'x_offset': 550, 'y_offset': 0})

            row += 15

        row += 2
        ws.write(row, 0, 'HelpDesk Set:', self.spFormats.bold_right)
        ws.write(row, 1, 'Statistics', self.spFormats.bold_left)

        #
        row += 1
        ws.write(row, 0, 'All:', self.spFormats.bold_right)
        self._write_stats(ws, row, reporter.stats)

        if reporter.stats['n'] > 0:
            row += 1
            ws.write(row, 0, 'Last 60 days:', self.spFormats.bold_right)
            self._write_stats(ws, row, reporter.statsOfRecent)

            row += 1
            ws.write(row, 0, 'Pending Issues:', self.spFormats.bold_right)
            self._write_stats(ws, row, reporter.statsOfPending)

        if len(reporter.deck):
            row += 1
            chart = painter.draw_resolution_time(reporter.resolutionTime_graph_data)
            ws.insert_chart(row, 1, chart, {'x_offset': 0, 'y_offset': 0})

            row += 15
            chart = painter.draw_evolution(reporter.evolution_graph_data)
            ws.insert_chart(row, 1, chart, {'x_offset': 0, 'y_offset': 0})

            row += 15
        row += 1
        _format = self.workbook.add_format({'bold': True, 'font_size': 16, 'bg_color': '#009999'})
        # ws.set_row(row, 50)
        # ws.merge_range(xl_range(row,1,row,2), "GE Owner's Analysis and Comments", _format)
        # row += 1
        # ws.set_row(row, 200)
        # ws.merge_range(xl_range(row,1,row,2), 'Please, write your analysis and comments on this cell')

        row += 1
        _format = self.workbook.add_format({'bold': True, 'font_size': 20, 'bg_color': '#3399FF', 'align': 'center'})
        ws.merge_range(xl_range(row, 0, row, 4), 'Help Desk Entries', _format)
        ws.write(row+1, 1, 'No entries found for this enabler in the Tech channel of the Help Desk')

        _center = self.workbook.add_format({'align': 'center'})

        if len(reporter.deck.unresolved):
            row += 1
            _format = self.workbook.add_format({'bold': True,
                                                'font_size': 20,
                                                'bg_color': '#CCFFE5',
                                                'align': 'center'})

            ws.merge_range(xl_range(row, 0, row, 4), 'Unresolved Issues', _format)
            row += 1
            ws.write_row(row, 0,
                         ('Item Id', 'Channel', 'Summary', 'Status', 'Age (#days)'), self.spFormats.column_heading)

            for issue in reporter.deck.unresolved:
                row += 1
                ws.write_url(row, 0, issue.url, self.spFormats.link, issue.key)
                ws.write(row, 1, issue.channel.name)
                ws.write(row, 2, issue.name)
                ws.write(row, 3, issue.status)
                ws.write(row, 4, issue.age, _center)
            else:
                ws.write(row+1, 0, '>>>>> {} issues found'.format(len(reporter.deck.unresolved)))
            row += 1

        if len(reporter.deck.resolved):
            row += 1
            _format = self.workbook.add_format({'bold': True,
                                                'font_size': 20,
                                                'bg_color': '#CCFFE5',
                                                'align': 'center'})

            ws.merge_range(xl_range(row, 0, row, 4), 'Resolved Issues', _format)
            row += 1
            ws.write_row(row, 0,
                         ('Resolution Date', 'Item Id', 'Summary', 'Status-Resolution', 'Age (#days)'),
                         self.spFormats.column_heading)

            for issue in reporter.deck.resolved:
                row += 1
                ws.write(row, 0, issue.resolutionDate, self.spFormats.date)
                ws.write_url(row, 1, issue.url, self.spFormats.link, issue.key)
                ws.write(row, 2, issue.name)
                ws.write(row, 3, '{0} - {1}'.format(issue.status, issue.resolution))
                ws.write(row, 4, issue.age, _center)
            else:
                ws.write(row+1, 0, '>>>>> {} issues found'.format(len(reporter.deck.resolved)))
示例#6
0
    def _enabler_dashboard(self, enabler):
        print('------>', enabler.name)
        wb = self.workbook
        ws = wb.add_worksheet(enabler.name)
        # backlog = self.factory.getEnablerBacklog(enabler.name)
        backlog = self.factory.getCoordinationBacklog(enabler.key)

        backlog.sort(key=backlog.sortDict['name'])

        painter = Painter(wb, ws)
        ws.set_zoom(80)
        ws.set_column(0, 0, 30)
        ws.set_column(1, 1, 122)
        ws.set_column(2, 5, 20)
        row, col = 0, 0

        _heading = self.workbook.add_format({
            'bold': True,
            'font_size': 30,
            'bg_color': '#002D67',
            'font_color': '#FFE616',
            'align': 'center'
        })
        ws.merge_range(xl_range(row, 0, row, 3),
                       "Backlog for Coordination: '{0}'".format(enabler.name),
                       _heading)
        ws.set_row(0, 42)
        ws.insert_image(0, 0, settings.logofiware, {
            'x_scale': 0.5,
            'y_scale': 0.5,
            'x_offset': 0,
            'y_offset': 0
        })

        row += 1
        ws.write(row, 0, 'Project Time:', self.spFormats.bold_right)
        ws.write(row, 1, '{}'.format(agileCalendar.projectTime()))

        ws.write(row, 2, 'Report Date:', self.spFormats.bold_right)
        ws.write(row, 3, date.today().strftime('%d-%m-%Y'))

        row += 1
        ws.write(row, 0, 'Start of Data Analysis:', self.spFormats.bold_right)
        ws.write(
            row, 1,
            '{}'.format(agileCalendar.projectTime(current_date=self.start)))

        row += 1
        ws.write(row, 0, 'End of Data Analysis:', self.spFormats.bold_right)
        ws.write(row, 1,
                 '{}'.format(agileCalendar.projectTime(current_date=self.end)))

        #
        row += 2
        _format = self.workbook.add_format({
            'bold': True,
            'font_size': 15,
            'color': 'green'
        })
        ename = enabler.name
        ws.write(row, 0, 'Enabler:', self.spFormats.bold_right)
        ws.write(row, 1, ename, _format)

        row += 1
        _format = self.workbook.add_format({
            'bold': True,
            'font_size': 15,
            'bg_color': '#60C1CF'
        })
        ws.write(row, 0, 'Product Owner:', self.spFormats.bold_right)
        ws.write(row, 1, '{} - {}'.format(enabler.owner, enabler.leader),
                 _format)
        ws.write(row, 2, '', _format)

        row += 1
        ws.write(row, 0, 'Work Mode:', self.spFormats.bold_right)
        ws.write(row, 1, 'Active')

        row += 2
        ws.write(row, 0, 'Backlog Summary:', self.spFormats.bold_right)
        ws.write(row, 1, '# Items', self.spFormats.bold_left)
        #
        row += 1
        # return
        reporter = EnablerReporter(enabler.name, backlog)
        data = reporter.issueType
        ws.write(row, 0, 'Composition', self.spFormats.bold_right)
        ws.write(
            row, 1, '{0:,} Issues = {Epic} Epics + {Feature} Features + '
            '{Story:,} User Stories + {WorkItem:,} WorkItems + {Bug} Bugs'.
            format(sum(data.values()), **data))
        #
        row += 1
        data = reporter.perspective
        ws.write(row, 0, 'Status', self.spFormats.bold_right)
        ws.write(
            row, 1,
            '{0:,} Issues = {Implemented:,} Implemented  + {Working On} Working On  + '
            ' {Foreseen} Foreseen'.format(sum(data.values()), **data))

        if not reporter.length:
            return

        row += 2
        chart = painter.draw_composition(reporter.issueType)
        ws.insert_chart(row, 1, chart, {'x_offset': 0, 'y_offset': 0})

        chart = painter.draw_status(reporter.perspective)
        ws.insert_chart(row, 1, chart, {'x_offset': 300, 'y_offset': 0})

        # Since FI-NEXT, we do not show the ERROR graphics anymore
        # chart = painter.draw_errors(reporter.errors)
        # ws.insert_chart(row, 1, chart, {'x_offset': 712, 'y_offset': 0})

        # row += 15
        # chart = painter.draw_sprint_burndown(reporter.burndown)
        # ws.insert_chart(row, 1, chart, {'x_offset': 0, 'y_offset': 0})

        # chart = painter.draw_sprint_status(reporter.sprint_status)
        # ws.insert_chart(row, 1, chart, {'x_offset': 712, 'y_offset': 0})

        row += 15
        chart = painter.draw_evolution(
            reporter.implemented(self.start, self.end))
        ws.insert_chart(row, 1, chart, {'x_offset': 0, 'y_offset': 0})
        row += 15

        row += 1
        _format = self.workbook.add_format({
            'bold': True,
            'font_size': 20,
            'bg_color': '#60C1CF',
            'align': 'center'
        })
        ws.merge_range(xl_range(row, 0, row, 4), 'Backlog Entries', _format)
        row += 1

        ws.write_row(
            row, 0,
            ('Item Id', 'Item reference', 'Time frame', 'Status', 'Item type'),
            self.spFormats.column_heading)
        for issue in backlog:
            row += 1
            self._write_issue(ws, row, issue)