Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
def send(config, mailing_list, output_file):
    connection = conn.postgres_connect(config)
    report_rows = conn.get_rows_count(connection,
                                      'vw_sprint_userstories_report')
    if report_rows > 0:
        statement = 'select * from vw_sprints_headers'
        sprints_headers = conn.get_rows(connection, statement)
        i = 1
        for sprint_header in sprints_headers:
            sprint_id = sprint_header['sprint_id']
            sprint_title = sprint_header['sprint_title']
            html = ""  # build_HTML(tot_report_headers,tot_report_data,userstories_report_headers,userstories_report_data,issues_report_headers,issues_report_data,image_title)
            tot_report_html = tot_report_to_HTML(sprint_title, connection)
            userstories_report_html = userstories_report_to_HTML(
                sprint_title, connection)
            issues_report_html = issues_report_to_HTML(sprint_title,
                                                       connection)
            if output_file:
                project_path = config['project']['path']
                html_lib = os.path.join(project_path, '.yodiz/debug/html/')
                html_file_name = os.path.join(
                    html_lib, 'sprints_{0}.html'.format(str(i)))
                html_file = open(html_file_name, "wb")
                html_file.writelines(html)
                html_file.close()
            else:
                create_sprint_chart(config, sprint_id)
                subject = "Sprint '{0}' report - day {1} out of {2} days".format(
                    sprint_header['sprint_title'], sprint_header['day_number'],
                    sprint_header['total_days'])
                to_list = None
                cc_list = None
                if mailing_list:
                    if 'blue' in sprint_header['sprint_title'].lower():
                        to_list = config['mailing_list']['sprints']['blue'][
                            'to']
                        cc_list = config['mailing_list']['sprints']['blue'][
                            'cc']
                    if 'query engine' in sprint_header['sprint_title'].lower():
                        to_list = config['mailing_list']['sprints']['green'][
                            'to']
                        cc_list = config['mailing_list']['sprints']['green'][
                            'cc']
                send_email_image(config,
                                 sprint_id,
                                 sprint_title,
                                 tot_report_html,
                                 userstories_report_html,
                                 issues_report_html,
                                 to_list=to_list,
                                 cc_list=cc_list)
            i += 1
Ejemplo n.º 3
0
def create_sprint_chart(config, sprint_id):
    connection = conn.postgres_connect(config)
    statement = "select * from vw_sprint_burndown_chart where sprint_id ={0} order by sprint_day".format(
        sprint_id)
    #print statement
    sprint_chart_data = conn.get_rows(connection, statement)
    remaining_days = []
    trend_line = []
    remaining_effort = []
    for item in sprint_chart_data:
        remaining_days.append(item['remaining_days'])
        trend_line.append(item['trend_line'])
        remaining_effort.append(item['remaining_effort'])
    #print trend_line
    chart.build_sprint_chart(config, sprint_id, remaining_days, trend_line,
                             remaining_effort)
Ejemplo n.º 4
0
def users_feedback(connection):
    statement = 'select count(*) from users'
    result = conn.get_rows(connection, statement)
    return result[0]['count']
Ejemplo n.º 5
0
def main():

    config = fnx.import_config(__file__)
    connection = conn.postgres_connect(config)
    # statement = "select * from vw_sprint_burndown_chart where sprint_id =159"
    # sprint_chart_data = conn.get_rows(connection,statement)
    # remaining_days = []
    # trend_line = []
    # remaining_effort = []
    # for item in sprint_chart_data:
    #     remaining_days.append (item['remaining_days'])
    #     trend_line.append(item['trend_line'])
    #     remaining_effort.append(item['remaining_effort'])
    # plot.build_sprint_chart(config, remaining_days,trend_line,remaining_effort)
    #sys.exit(0)
    dbname = config['postgres']['dbname']
    port = config['postgres']['port']
    host = config['postgres']['host']
    user = config['postgres']['user']
    project_path = config['project']['path']
    project_name = config['project']['name']
    project_full_path = os.path.join(project_path, project_name)
    html_lib = os.path.join(project_path, '.yodiz/debug/html/')
    python = config['prerequisites']['python']

    params = argp.params()
    if params.cmd_object == 'build':
        db_object = ""
        if params.database:
            db_object = "database"
        if params.views:
            db_object = "views"
        if params.ddl:
            print "created {0} ddl file for database {1}".format(
                db_object, dbname)
            statement = "{0}.yodiz/build/{1}_build.sh".format(
                project_path, db_object)
            os.system(statement)
        if params.execute:
            print "executed {0} ddl file on database {1}".format(
                db_object, dbname)
            statement = "psql -h {0} -p {1} -d {2} -U {3} -a -f {4}.yodiz/build/{5}_build.sql".format(
                host, port, dbname, user, project_path, db_object)
            os.system(statement)

    if params.cmd_object == 'pull':
        transact_guid = uuid.uuid4()
        url_headers = {}
        url_headers['api-key'] = config["yodiz"]["api-key"]  #params.key
        url_headers['api-token'] = config["yodiz"]["api-token"]  #params.token
        table_name = params.resource
        if params.truncate:
            conn.truncate_table(config, table_name, transact_guid)
        if params.resource == 'sprints':
            sprints_extractor.extract(config, url_headers, transact_guid)
        if params.resource == 'releases':
            releases_extractor.extract(config, url_headers, transact_guid)
        if params.resource == 'users':
            users_extractor.extract(config, url_headers, transact_guid)
        if params.resource == 'issues':
            issues_extractor.extract(config, url_headers, transact_guid)
        if params.resource == 'userstories':
            userstories_extractor.extract(config, url_headers, transact_guid)
        if params.resource == 'tasks':
            tasks_extractor.extract(config, url_headers, transact_guid)

    if params.cmd_object == 'mail':
        if params.sprints:
            sprints_mail.send(config, params.mailing_list, params.output_file)
        if params.capacity:
            capacity_mail.send(config, params.mailing_list, params.output_file)
        if params.release:
            release_mail.send(config, params.mailing_list)
        if params.inv:
            inv_mail.send(config)

    if params.cmd_object == 'query':
        if params.sprints:
            statement = 'select * from {0}'.format(params.sprints)
            rows = conn.get_rows(connection, statement)
            for row in rows:
                print 'sprint title: {0} , sprint id:{1}'.format(
                    row['sprint_title'], row['sprint_id'])
Ejemplo n.º 6
0
def sprints_feedbak(connection):
    statement = 'select count(*) from sprints'
    result = conn.get_rows(connection, statement)
    return result[0]['count']
Ejemplo n.º 7
0
def get_userstories_ids(connection):
    statement = 'select userstory_id from vw_userstories'
    userstories_ids = conn.get_rows(connection, statement)
    return userstories_ids