def sprint_report(jira_access, board_name, project_key): board = jira_access.boards(type="scrum", name=board_name)[0] sprint = jira_access.sprints(board_id=board.id, state="active")[0] content = page.format_text("h4", f"Current Sprint: {sprint.name}") content += page.format_text( "p", f'Start: {sprint.startDate.split("T")[0]}, End: {sprint.endDate.split("T")[0]}', ) content += page.format_text("p", f'Goal: "{sprint.goal}"') percentage, all_issues, done_issues = algo.active_sprint_progress( jira_access, project_key) content += page.format_text( "p", f"Sprint execution progress: {percentage}% ({len(done_issues)}/{len(all_issues)})", ) content += page.embed_expand_macro( page.embed_jira_macro( f'project = "{project_key}" and sprint in OpenSprints()'), "Ongoing in current sprint", ) return content, []
def dependency_report(independence, all_issues, all_with_dep, metrics_history=None): content = page.format_text( "h3", f"Independence factor = {round(independence)}% ") attachments = [] if metrics_history: chart_file = metrics_history_chart(metrics_history) attachments.append(chart_file) content += page.embed_image(filename=chart_file) if len(all_with_dep): # dependency charts content += page.format_text("h2", "External dependency split") count_stats = dep.count_stats(all_with_dep) stats_list = [i for i in count_stats if len(i) > 0] att = [] att.append( stats_pie_charts( stats_list, title=None, sub_titles=("By team", "By Epic", "By external epic"), )) content += page.embed_images(filename_list=att) attachments += att # dependency graphs dependency_content, dependency_graphs = dependency_analysis( all_with_dep) content += dependency_content attachments += dependency_graphs return content, attachments
def report_head(title, description=None): content = page.format_text( "h5", f"Report timestamp {datetime.datetime.now():%Y-%m-%d %H:%M}" ) content += page.format_text("h2", title) if description is not None: content += page.format_text("p", description) return content, []
def project_report( percentage, all_issues, jql_all_issues, status_done, product_name=None, board_name=None, ): content = "" attachments = [] if len(all_issues) > 0: jira_access = all_issues[0].jira_access project_key = all_issues[0].project.name content += page.format_text("h4", f"Percentage done: {percentage}%") if board_name: content += sprint_components.sprint_report( jira_access, board_name, project_key )[0] content += page.format_text("h4", f"All issues: {len(all_issues)}") content += page.embed_expand_macro( page.embed_jira_macro(jql_all_issues), "All issues" ) content += page.embed_pie_marco(jql=jql_all_issues, stat_type="statuses") content += page.format_text("h4", "Reminding work") content += page.embed_expand_macro( page.embed_jira_macro( f"{jql_all_issues} and status not in ({status_done})" ), "Reminding work", ) if product_name: content += page.format_text("h4", f"Risks") content += risks_report(product_name)[0] issues_with_links = [i for i in all_issues if len(i.load_linked_issues()) > 0] if len(issues_with_links): content += page.format_text("h4", f"Blocked stories") content += page.embed_jira_macro(f"status = Blocked and {jql_all_issues}") ( dependency_content, dependency_graphs, ) = dependency_components.dependency_analysis(issues_with_links) content += dependency_content attachments += dependency_graphs return content, attachments
def maintenance_report(labels, trend, active_maintenance=[], title=""): created_counts = [len(t[0]) for t in trend] resolved_counts = [len(t[1]) for t in trend] mntc_chart = maintenance_created_vs_resolved_chart(labels, created_counts, resolved_counts) content = page.embed_image(filename=mntc_chart) averages = [] stds = [] for t in trend: resolved = t[1] lead_time = [] for i in resolved: lead_time.append(i.calc_lead_time()) averages.append(int(round(np.average(lead_time), 0))) stds.append(round(np.std(lead_time), 0)) lt_chart = resolved_issues_lead_times(labels, averages, stds) content += page.embed_image(filename=lt_chart) if active_maintenance: content += page.format_text( "p", f"Active maintenance: {len(active_maintenance)}") content += page.embed_expand_macro( page.embed_jira_macro( f'issuekey in ({", ".join(active_maintenance)})'), "Maintenance backlog", ) return content, [mntc_chart, lt_chart]
def maintenance_report(created_defects, resolved_defects, title=""): created_count = len(created_defects) resolved_count = len(resolved_defects) content = page.format_text( "p", f"{title} - created defects: {created_count}, resolved defects: {resolved_count}", ) return content, []
def history_execution_report(history): barh_chart_filename = execution_progress_chart(history) content = page.embed_image(filename=barh_chart_filename) last_sprint_key = next(reversed(history.keys())) last_sprint = history[last_sprint_key].sprint goal = last_sprint.goal if hasattr(last_sprint, "goal") else "" if last_sprint.state == "active": content += page.format_text("p", f'Active sprint: "{last_sprint.name}"') content += page.format_text("p", f'The goal of the active sprint: "{goal}"') else: content += page.format_text( "p", f'No sprint is active. Last sprint: "{last_sprint.name}"' ) content += page.format_text("p", f'The goal of the last sprint: "{goal}"') content += page.format_text( "p", f'Start: {last_sprint.startDate.split("T")[0]}, End: {last_sprint.endDate.split("T")[0]}', ) return content, [barh_chart_filename]
def dependency_summary(jira_access, metrics_history, project_list): new_content = "" attachments = [] table = {"Squad": [], "Factor": [], "Date": [], "Trend": []} for k, v in metrics_history.items(): table["Squad"].append( page.format_link(f"{k} - Dependencies after refinement", k)) table["Factor"].append(f'{round(v.latest["independence"])}%') table["Date"].append( datetime.datetime.fromtimestamp(v.latest["timestamp"]).date()) trend = v.trend trend_arrow = page.rightwards_arrow() if trend > 0: trend_arrow = page.upwards_arrow() elif trend < 0: trend_arrow = page.downwards_arrow() table["Trend"].append(trend_arrow) total_m = metrics_store.merge(metrics_history.values()) new_content += page.format_text( "h3", f'Total factor = {total_m.latest["independence"]}% ') chart_file = metrics_history_chart(total_m) attachments.append(chart_file) new_content += page.embed_image(filename=chart_file) if jira_access is not None: more_analysis_content, more_att = internal_vs_external_dependencies( jira_access, project_list, total_m) new_content += page.embed_expand_macro(more_analysis_content, "More analysis...") attachments += more_att new_content += page.format_table(table) return new_content, attachments
def report_legend(legend, title="Legend"): content = page.format_text("h2", title) content += page.format_unordered_list(legend) return content, []
def report_heading(tag, text): content = page.format_text(tag, text) return content, []