示例#1
0
def runReportForSprint(project,
                       board_id,
                       sprint_id,
                       jira=None,
                       getdailyrep=False):
    if jira is None:
        jira = jc.psup_login()
        print('Login OK')

    sprints = sp.getSprints(jira, board_id, project)
    sprint = sprints.loc[sprint_id]
    filename = 'sprintReport_{}_{}_{}_{}.xlsx'.format(
        project, sprint['Team'], sprint['Sprint'],
        dt.datetime.now().strftime("%Y-%m-%d"))
    filename = re.sub('[\/:*?"<>|]+', '_', filename)
    sp.sprintReport(project, filename, sprint, jira, getdailyrep=getdailyrep)
    return
示例#2
0
def runReport(project, jira=None, sprint=0, getdailyrep=False):

    if jira is None:
        jira = jc.psup_login()
        print('Login OK')

    for board_id in boardsByProject(project):
        sprints = sp.getSprints(jira, board_id, project)
        sprints_filtered = sp.getSprintIDs(sprints, sprint)

        if len(sprints_filtered) == 0:
            print('No active sprints for board {}!'.format(board_id))
            continue

        for sprint_id in sprints_filtered.index.get_values():
            runReportForSprint(project,
                               board_id,
                               sprint_id,
                               jira,
                               getdailyrep=getdailyrep)

    return
示例#3
0
import pandas as pd
import jiraConnector as jc
import common as cmn
import datetime as dt
import pytz

jira = jc.psup_login()

jql = '"Epic link" in (CHOM-2423,CHOM-2344)'

def parse_components(components):
    c = set()
    for component in components:
        c.add(component.name)
    return c

def alignComponents(jql, jira, update, add_clause=""):

    stories = jira.search_issues(jql,maxResults=1000)

    print('Loaded {} stories'.format(len(stories)))

    stories_keys = list([x.key for x in stories])
    stories_list = list(map(lambda x:
                        [parse_components(x.fields.components)],
                        stories))
    stories_df = pd.DataFrame(stories_list,
                                index=stories_keys,
                                columns=['components'])

    subtasks_jql = 'parent in (' + ','.join(str(key) for key in stories_keys) + ') and created > -10d'
示例#4
0
def FRreport(
    filename,
    FR_filter,
    Stories_filter,
    project,
    path = cmn.DEFAULT_PATH + 'Documents\\',
    add_clause = '',
    WBSpath = '',
    WBStag = 'WBS',
    timesheet = None):

    jira = jc.psup_login()

    print('Login OK')

    if len(FR_filter) > 0:
        FRs = jc.get_FRs(jira, FR_filter, WBStag=WBStag)

        print('Loaded ' + str(len(FRs)) + ' FRs')

        Stories = jc.get_Stories(jira, FRs=FRs.index, add_clause=add_clause, WBStag=WBStag)
    else:
        Stories = jc.get_Stories(jira, filter_id=Stories_filter, WBStag=WBStag)

    print('Loaded ' + str(len(Stories)) + ' Stories')

    subtasks = jc.get_subtasks(jira, Stories)

    print('Loaded ' + str(len(subtasks)) + ' subtasks')

    subtasks = subtasks.sort_values('Sprint').sort_index()
    Stories = Stories.sort_index(level=0).sort_values('Sprint')
    Stories_enriched = Stories.join(Stories.apply(lambda row: calc_subtasks(row.name[1],Stories, subtasks),axis=1))

    if len(FR_filter) > 0:
        FRs = FRs.sort_values('Sprint')
        FRs_enriched = FRs.join(Stories_enriched[[
            'cnt_dev_implemented',
            'cnt_done',
            'cnt_done_qa',
            'cnt_nonqa',
            'cnt_qa',
            'cnt_total',
            'Σ Time Spent',
            'nonqa_fact',
            'qa_fact',
            'nonqa_remaining',
            'qa_remaining',
            'total_remaining',
            'done_estimate',
            'done_qa_estimate',
            'implemented_dev_estimate',
            'nonqa_estimate',
            'qa_estimate',
            'total_estimate']].groupby(level=0).sum()).fillna(0)
        FRs_enriched = FRs_enriched.join(FRs_enriched.apply(lambda row: FRs_rate(row,Stories),axis=1))

        WBS_columns = ['Module',
                       'Sprint wbs',
                       'Customer wbs',
                       'Tech LOE wbs',
                       'Impl LOE wbs',
                       'QA LOE wbs']
        names = ['Scope of Work',
                'Customer wbs',
                'Module',
                'Sprint wbs',
                'Estimated By',
                'Details/Assumptions',
                'Analysis LOE wbs',
                'Bug Fixing LOE wbs',
                'Design LOE wbs', 
                'Build LOE wbs',
                'QA LOE wbs',
                'Tech LOE wbs']
        subset = ['Customer wbs',
                'Module',
                'Sprint wbs',
                'Estimated By']

        if WBSpath != '':
            WBS = wbs.loadWBS(WBSpath,names,subset)
            FRs_enriched = FRs_enriched.join(WBS[WBS_columns])
        else:
            FRs_enriched = FRs_enriched.reindex(columns = np.append(FRs_enriched.columns.values,WBS_columns))

    print('Calculations OK')

    if len(FR_filter) > 0:
        write_report(path + filename,
                 FRs_enriched,
                 Stories_enriched,
                 subtasks,
                 project,
                 np.append(cmn.FRs_columns,WBS_columns),
                 np.append(cmn.FRs_labels,WBS_columns),
                 timesheet)
    else:
        write_report_short(path + filename,
                             Stories_enriched,
                             subtasks,
                             project,
                             timesheet)

    print('Done!')

    return