def send(config, mailing_list): connection = conn.postgres_connect(config) report_rows = conn.get_rows_count(connection, 'vw_sprint_userstories_report') if report_rows > 0: # release headers for email subject release_headers = conn.get_rows(connection, "select * from vw_release_headers")[0] # release summary fields and data tot_report_data = conn.postgres_rows_select( connection, "select * from vw_release_summary_report") tot_report_headers = conn.get_table_culomns( connection, 'vw_release_summary_report') # release userstories fields and data sub_tot_report_data = conn.postgres_rows_select( connection, "select * from vw_release_userstories_report") sub_tot_report_headers = conn.get_table_culomns( connection, 'vw_release_userstories_report') html = report_to_html_doc(tot_report_headers, tot_report_data, sub_tot_report_headers, sub_tot_report_data) subject = "Release '{0}' report - day {1} out of {2} days".format( release_headers['release_title'], release_headers['day_number'], release_headers['total_days']) to_list = None cc_list = None if mailing_list: to_list = config['mailing_list']['release']['to'] cc_list = config['mailing_list']['release']['cc'] fnx.send_email(subject, html, to_list, cc_list)
def send(config): connection = conn.postgres_connect(config) tasks_headers = conn.get_table_culomns(connection, 'vw_inventory_tot') tasks_data = conn.postgres_rows_select(connection, 'select * from vw_inventory_tot') html = report_to_html_table(tasks_headers, tasks_data) subject = "Yodiz Data Validation Report" to_list = None cc_list = None fnx.send_email(subject, html, to_list=to_list, cc_list=cc_list)
def userstories_report_to_HTML(sprint_title, connection): userstories_report_headers = conn.get_table_culomns( connection, 'vw_sprint_userstories_report') statement = "select * from vw_sprint_userstories_report where sprint_title='{0}'".format( sprint_title) userstories_report_data = conn.postgres_rows_select(connection, statement) userstory_html = """ <table style="border-collapse: collapse;width: 100%;"> <tr> """ #build table header for header in userstories_report_headers[1:]: userstory_html += """ <th style="background-color:#D9E9FF;">{}</th> """.format(header) userstory_html += """ </tr> """ #build table data for row in userstories_report_data: set_color = set_status_color(row[3]) if set_color is not None: userstory_html += """ <tr bgcolor="{0}" style="border-style:solid"> """.format(set_color) else: userstory_html += """ <tr style="border-style:solid"> """ #set second column id as hyperlink link = 'https://app.yodiz.com/plan/pages/board.vz?cid=21431#/app/us-{0}'.format( row[1]) userstory_html += """ <td style='padding:5px'><a href='{0}' target='_blank'>{1}</a></td> """.format(link, row[1]) for i, field in enumerate(row[2:]): color = "" if (i == 3 and int(field) > 0): color = "color:red;font-weight:bold" userstory_html += """ <td style='padding:5px'><span style="{1}">{0}</span></td> """.format(field, color) userstory_html += """ </tr> """ userstory_html += """ </table> """ return userstory_html
def send(config, mailing_list, output_file): connection = conn.postgres_connect(config) unassigned_report_data = conn.postgres_rows_select( connection, 'select full_name from vw_capacity_unassigned') capacity_report_headers = conn.get_table_culomns(connection, 'vw_capacity_report') capacity_report_data = conn.postgres_rows_select( connection, 'select * from vw_capacity_report where "Sprint Title" is not null') html = build_HTML(capacity_report_headers, capacity_report_data, unassigned_report_data) if output_file: print output_file else: subject = "R&D members - Sprint capacity report" to_list = None cc_list = None if mailing_list: to_list = config['mailing_list']['capacity']['to'] cc_list = config['mailing_list']['capacity']['cc'] fnx.send_email(subject, html, to_list=to_list, cc_list=cc_list)
def tot_report_to_HTML(sprint_title, connection): statement = "select * from vw_sprint_summary_report where sprint_title='{0}'".format( sprint_title) tot_report_headers = conn.get_table_culomns(connection, 'vw_sprint_summary_report') tot_report_data = conn.postgres_rows_select(connection, statement) tot_html = """ <div style="float: left;"> <table style="margin-top:12%; border-collapse:collapse; width:30%;"> <tr> """ #build table header for header in tot_report_headers[1:]: tot_html += """ <th style='text-align: left;padding: 8px;background-color:black;color:white;'>{}</th> """.format(header) tot_html += """ </tr> """ #build table data for row in tot_report_data: tot_html += """ <tr style="border-style:solid"> """ #set second column id as hyperlink for field in row[1:]: tot_html += """ <td style='padding:5px'>{}</td> """.format(field) tot_html += """ </tr> """ tot_html += """ </table> </div> """ return tot_html