【问题标题】:Fetch worklog results of a particular user获取特定用户的工作日志结果
【发布时间】:2018-01-04 13:08:29
【问题描述】:

我想获取每个用户每周在特定项目中登录的总小时数。

为了实现这一点,我试图在项目中获取整个工作日志,然后通过工作日志作者对其进行过滤。这是我正在使用的查询:

https://jira.example.com/rest/api/2/search?startIndex=0&maxResults=100&jql=project=%27Test%20Project%27+and+worklogAuthor=testUser+and+updated%3E=-7d&fields=worklog

这将带回过去 7 天内已更新的每个问题,并且用户与其相关。但是,它也会带回另一个用户的工作日志,该用户在同一问题中增加了时间。

我的问题如下,有没有办法按名称过滤查询,并带回特定用户的工作日志,而没有其他用户的工作日志与相同的简单相关问题?

查询以 json 格式返回用户的每个工作日志的结果,如下所示:

"worklogs": [
{
"author": {...}, // 8 items, where there's a 'name' field for the particular user
"updateAuthor": {...}, // 8 items
"comment": "",
"created": "2018-01-03T13:42:15.000+0200",
"updated": "2018-01-03T13:42:15.000+0200",
"started": "2018-01-03T13:42:00.000+0200",
"timeSpent": "1h",
"timeSpentSeconds": 3600,
"id": "10540",
"issueId": "10674"
},

谢谢

【问题讨论】:

    标签: jira jira-rest-api jql


    【解决方案1】:

    我认为开箱即用的 jira 不可能做到这一点。 jira rest api 仅支持检索问题的工作日志,不支持检索用户。

    但是,有像 Script Runner 这样的附加组件提供额外的 JQL 函数,允许您查询特定用户已登录工作的问题。您可以使用search REST API 轻松执行这样的JQL。这将为您提供一个较小的问题/工作日志列表以供过滤。

    JQL 示例:

    issueFunction in workLogged(on "2015/07/28" by admin)
    

    有关自定义 jql 函数的更多信息,请参阅 Script Runner documentation

    【讨论】:

      【解决方案2】:
      worklogAuthor = currentUser()
      

      worklogAuthor = marc
      

      可能对你有帮助

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-08-21
        • 2013-06-24
        • 2019-02-24
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-10-31
        • 1970-01-01
        相关资源
        最近更新 更多