Problem Jira search all issues in a project

Alex
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 27, 2023

Greetings! I made automation (python +jira) , where I get a report that collects: "Top 5 projects from which most tickets are escalated to my project" and the report "Top 5 projects to which we escalate tickets most of all" But I have a little problem :- Instead of 806 issues, I have only 36 issues being processed (only the first jira page with tickets) Please help find the answer. Any help is appreciated! Thank you.

 
 
#coding=utf8

    import os

    import csv

    from functionstelegram import get_jira

    import smtplib

    from itertools import zip_longest

    from email.mime.multipart import MIMEMultipart

    from email.mime.text import MIMEText

    from email.mime.base import MIMEBase

    from email import encoders

    from email.mime.application import MIMEApplication

    # import datetime

    # from xlsxwriter.workbook import Workbook

    from collections import Counter

    jira = get_jira()

    results = jira.search_issues('project = "MRCHNT" AND issueLinkType in (clone,"cloned by")  AND created >= startOfDay()')

    list_owi_issues_key = []
    list_iwi_issues_key = []

    for issueId in results:

        issue = jira.issue(issueId)

        print(issue)

        for link in issue.fields.issuelinks:

            if hasattr(link, "outwardIssue"):

                outwardIssue = link.outwardIssue

                list_owi_issues_key.append(outwardIssue.key)

                print("\tOutward: " + outwardIssue.key)

            if hasattr(link, "inwardIssue"):

                inwardIssue = link.inwardIssue

                list_iwi_issues_key.append(inwardIssue.key)

                print("\tInward: " + inwardIssue.key)

    #print(list_owi_issues_key)

    #print(list_iwi_issues_key)

    list_modify_owi = []

    list_count_issue_owi = []

    for loik in list_owi_issues_key:

        modify_loik = loik.split('-')

        modify_loik_2 = (''.join(modify_loik[0]))

        list_modify_owi.append(modify_loik_2)

    print("\nList issues outward : {}".format((list_owi_issues_key)))

    project_list_unique = list(set(list_modify_owi))

    print("\nUnique Project outward : {}\n".format((project_list_unique)))

    for pj in project_list_unique:

        count_issue_owi_project = list_modify_owi.count(pj)

        list_count_issue_owi.append(count_issue_owi_project)

    test = dict(zip(project_list_unique, list_count_issue_owi))

    # print(test)

    c = Counter(test)

    # [('four', 4), ('three', 3), ('two', 2), ('one', 1)]

    top_pj = c.most_common()

    print(top_pj)

    print(top_pj[0])

    print(top_pj[0][0])

    print(top_pj[0][1])

    print(top_pj[1])

    print(top_pj[1][0])

    print(top_pj[1][1])

    print(top_pj[2])

    print(top_pj[2][0])

    print(top_pj[2][1])

    print(top_pj[3])

    print(top_pj[3][0])

    print(top_pj[3][1])

    print(top_pj[4])

    print(top_pj[4][0])

    print(top_pj[4][1])

    ############################################################# INWARD

    list_modify_iwi = []
    list_count_issue_iwi = []
    for liik in list_iwi_issues_key:

        modify_liik = liik.split('-')

        modify_liik_2 = (''.join(modify_liik[0]))

        list_modify_iwi.append(modify_liik_2)

    print("\nList issues inward : {}".format((list_iwi_issues_key)))

    project_iwi_list_unique = list(set(list_modify_iwi))

    print("\nUnique Project inward : {}\n".format((project_iwi_list_unique)))

    for pj_iwi in project_iwi_list_unique:

        count_issue_iwi_project = list_modify_iwi.count(pj_iwi)

        list_count_issue_iwi.append(count_issue_iwi_project)

    test_iwi = dict(zip(project_iwi_list_unique, list_count_issue_iwi))

    # print(test)

    c = Counter(test_iwi)

    # [('four', 4), ('three', 3), ('two', 2), ('one', 1)]

    top_pj_iwi = c.most_common()

    print(top_pj_iwi)

    print(top_pj_iwi[0])

    print(top_pj_iwi[0][0])

    print(top_pj_iwi[0][1])

    print(top_pj_iwi[1])

    print(top_pj_iwi[1][0])

    print(top_pj_iwi[1][1])

    print(top_pj_iwi[2])

    print(top_pj_iwi[2][0])

    print(top_pj_iwi[2][1])

    print(top_pj_iwi[3])

    print(top_pj_iwi[3][0])

    print(top_pj_iwi[3][1])

    print(top_pj_iwi[4])

    print(top_pj_iwi[4][0])

    print(top_pj_iwi[4][1])

1 answer

0 votes
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 27, 2023

Where are you not getting the output you expect?

Where in your code do you have debug code to validate throughout that you have the data you expect and various points?

Suggest an answer

Log in or Sign up to answer