Jira 基于自定义搜索检索错误总数

Jira 基于自定义搜索检索错误总数,jira,jira-rest-api,Jira,Jira Rest Api,我试图检索项目中的问题计数,这些问题是bug,其状态已关闭或已解决,且解决方案已修复。除此之外,我还试图确保bug的受让人与报告人不同,或者受让人不是未分配的 这就是我到目前为止所做的: https://issues.apache.org/jira/rest/api/2/search?jql=issuetype=Bug and resolution=Fixed and status= Resolved or status = Closed and project=AMQ and assignee

我试图检索项目中的问题计数,这些问题是bug,其状态已关闭或已解决,且解决方案已修复。除此之外,我还试图确保bug的受让人与报告人不同,或者受让人不是未分配的

这就是我到目前为止所做的:

https://issues.apache.org/jira/rest/api/2/search?jql=issuetype=Bug and resolution=Fixed and status= Resolved or status = Closed and project=AMQ and assignee!=reporter and assignee != ''

但是,返回的总计数大于项目存储库中存在的bug的实际计数。请帮忙

无法使用
进行筛选=reporter
当您尝试API调用时。此外,您必须使用
受让人不为空
而不是
受让人!=''在没有受让人的情况下获取问题。最后,您需要在
(status=Resolved或status=Closed)
周围加上括号,以避免陷入错误或陷阱

如果将python与一起使用,则获得所需结果的代码如下:

# connect to your JIRA instance
jira = JIRA('https://issues.apache.org/')

# get the issues via API search
issues = jira.search_issues("issuetype=Bug AND resolution=Fixed AND (status=Resolved or status=Closed) AND project=AMQ AND assignee is NOT EMPTY")

filtered_issues = [] # this variable will hold the correct list of issues

# filter the tickets where assignee != reporter
for issue in issues:

    # to prevent AttributeError due to possible NoneType
    try:
        reporter = issue.fields.reporter.key
    except AttributeError:
        reporter = ""

    # to prevent AttributeError due to possible NoneType
    try:
        assignee = issue.fields.assignee.key
    except AttributeError:
        assignee = ""

    if reporter != assignee:
        filtered_issues.append(issue)

print(filtered_issues) # list of issues
print(len(filtered_issues)) # number of issues