Exemple #1
0
def json_story_post(scrumteam, jira_connection):
    # Body
    body = '''
    {
        "jql": "filter=AWO-%s-Sprint-Story",
                    "startAt": 0,
                "maxResults" : 1000
    }
    ''' % scrumteam

    jira_connection = JiraConnection()

    jira_connection.\
            setUserAndPass(userpsw).\
            setHeader().\
            setBody(body)

    try:
        x = jira_connection.sendRequest()
    except Exception:
        raise

    story = Story(json.loads(x.decode()))

    return story.get_story()
Exemple #2
0
from jira_connection_base import JiraConnection
import configuration
import pandas as pd
import io, pkgutil
import sys
from itertools import groupby
import name

jira_connection = JiraConnection()
jira_connection. \
    setUserAndPass(configuration.userpsw). \
    setHeader()

esi_url = '''/sr/jira.issueviews:searchrequest-csv-all-fields/temp/SearchRequest.csv?jqlQuery=Project+%3D+%22AWO+Product+Development%22+AND+type+%3D+%22Escalated+Support+Issue%22+AND+createdDate+%3E+2018-01-01'''
bug_url = '''/sr/jira.issueviews:searchrequest-csv-all-fields/temp/SearchRequest.csv?jqlQuery=Project+%3D+%22AWO+Product+Development%22+AND+type+%3D+Bug+AND+status+%3D+closed+AND+createdDate+%3E+2018-11-01'''

# environment settings:
pd.set_option('display.max_columns', None)
pd.set_option('display.expand_frame_repr', False)
pd.set_option('max_colwidth', -1)


def download_csv_file(issuetype, url):
    raw = jira_connection.requestInGet(url)
    f = open(issuetype + '.csv', 'wb')
    f.write(raw)
    f.close()


def count_on_name(logs):
    data = []
Exemple #3
0
def report():

    if (DEBUG):
        print("Test story...")
        stories = test_storyfile_json()
        story_data = story_crunch(stories)
        ax = story_data.plot(kind='barh')
        for p in ax.patches:
            ax.annotate(str(p.get_width()),
                        (p.get_width() * 1.005, p.get_y() * 1.005))

        plt.subplots_adjust(left=0.2)
        plt.show()

        print("Test task...")
        tasks = test_taskfile_json()
        task_data = task_crunch(tasks)
        task_data.plot.pie(subplots=True,
                           y=['Remaining_hrs'],
                           figsize=(6, 6),
                           radius=0.7)

        plt.legend(loc="lower right",
                   fontsize=10,
                   bbox_transform=plt.gcf().transFigure)
        plt.subplots_adjust(left=0.0, bottom=0.1, right=0.85)
        plt.show()

    if (not DEBUG):
        rpt = open("report.html", "w+")
        rpt.write('<h3> The data generated from JIRA at: ' +
                  time.strftime("%c") + '</h3>')

        jira_connection = JiraConnection()

        if (jira_connection == None):
            return None

        summary = pd.DataFrame(
            columns=['Total Story Point', 'Average Bug Rate'])
        for i in range(1, 11):
            try:
                if i < 8:
                    CNx = "CN" + str(i)
                else:
                    CNx = "NA" + str(i - 7)

                rpt.write('<hr/>')
                rpt.write('<h2>Team: %s</h2>' % CNx)

                # render story
                stories = json_story_post(CNx, jira_connection)
                story_data = story_crunch(stories)

                ax = story_data.plot(kind='barh')
                for p in ax.patches:
                    ax.annotate(str(p.get_width()),
                                (p.get_width() * 1.01, p.get_y() * 1.005))

                plt.subplots_adjust(left=0.2)
                plt.savefig('pic/SP_' + CNx + '.png')

                rpt.write('<img src="/pic/SP_' + CNx + '.png' + '" />')

                rpt.write('<span style="display: inline-block">%s</span>' %
                          story_data.to_html())

                rpt.flush()

                # render task
                tasks = json_task_post(CNx, jira_connection)
                task_data = task_crunch(tasks)

                rpt.write('<span style="display: inline-block">%s</span>' %
                          task_data.to_html())
                #
                # summary.append(pd.DataFrame(
                #     [story_data['Story Point'].sum(),story_data['Bug'].sum()/story_data['Story Point'].sum()],
                #     index=str(i)))

                summary.loc[CNx, ['Total Story Point', 'Average Bug Rate']] = \
                    [story_data['Story Point'].sum(),
                     round(story_data['Bug'].sum()/story_data['Story Point'].sum(),3)]

            except IOError:
                print(IOError.errno)
            finally:
                rpt.flush()
                plt.close()
                plt.close("all")

        rpt.write('<hr/>')
        rpt.write('<h3> Team Summary </h3>')
        rpt.write('<span style="display: inline-block">%s</span>' %
                  summary.to_html())
        rpt.flush()
        rpt.close()