Jira TimeSpent query for the users who logs hours.

Sujith Saji November 18, 2019

Hi, 

 

I have a JiraQuery to pull the TimeSpent column for certain sprint and it looks great.

The issue I am facing is, it is not giving any details about the users other than assignee.

 

Eg: If users other than an assignee logs hours in story, then the TimeSpent column shows those hours against  the jira hence against the assignee.

Is there any function or query elements or column-names which can be used to pull hours logged by users, not by Assignee of the story?

No plugin or Database accesses available.

Thanks in Advance!!!!

 

2 answers

1 accepted

1 vote
Answer accepted
Thomas Magny-Garcia
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.
November 18, 2019

Hi @Sujith_Saji 

With a JQL Query, you may use

worklogAuthor in (...) 

that allows you to look for issue with some hours logged by particular users.

But I don't think you may pull only the hours logged by a particular user (not natively I mean).

 

Hope it helps !

1 vote
Tom Hawkins October 5, 2021

Sharing some info from our experience in case it helps (Some clever colleagues deserve credit for part 1 rather than me!)

Requirement 1: Summing up values of worklogs by developer by week: Whilst irritating that front-end doesn't do this (JQL limitation in use case of Time Spent on single issue in period being spread across developers), as workaround found a way of using API query to sum time by user in a period that we believe avoids any of the known downsides: 

1. not needing a paid App / plugin / addon such as 

2. not being limited to assignee

3. being by user rather than only giving TimeSpent by worklog date (front end JQL apparently has limitation that it would sum TimeSpent by issue in period even where worklogauthors > 1) 

http:// {YOUR JIRA ADDRESS}  /rest/api/2/search?jql=worklogAuthor= {THE USERNAME OF THE USER BEING QUERIED}  %20and%20worklogDate%20%3E%202021-09-26%20and%20worklogDate%20%3C%202021-10-04%20and%20timespent%20%3E%200&fields=summary,worklog&maxResults=1000 

returns everything after end of 2021-09-26 and before start of 2021-10-04 (in other words, the week between start of Mon Sep 27 and end of Sun Oct 3) but with the worklog times logged specific to the relevant developer only we believe. 

Requirement 2: Seeing a list of Epics which a user has worked on where EpicLink not empty: "Example filter for condensing a list of issues into a list of their Epics where not empty (with clauses for finding if issue in (Epic itself, Child or Grandchild)"  need a way of building the query so that

  1. start with (
  2. for each of the Jiras returned by the Requirement 1 query there needs to be a block which says key in (parentIssuesOf(KEY1)) with " OR " as a separator, eg key in (parentIssuesOf(KEY1)) OR key in (parentIssuesOf(KEY2)) key in (parentIssuesOf(KEY3)) etc for as many issue KEYs as are found in first query**** --this finds Epics from lists of child (eg. Bug, Story, Improvement, Live Issue, Task, New Feature) AND grandchild (eg. Subtasks) issue types
  3. then OR key in (KEY1, KEY2, KEY3) --this ensures that the query finds Epics where the worklog is on the epic itself rather than a child/grandchild
  4. then ) and type in (Epic) – this filters the output to Epics only. 

eg. (key in (parentIssuesOf(KEY1)) OR key in (parentIssuesOf(KEY2)) OR key in (parentIssuesOf(KEY3)) OR key in (KEY1, KEY2, KEY3)) AND type = Epic

Jagadeesh Rangaswamy February 9, 2022

Hi Tom,

Regd#1

While it helps pull for certain user, it pulls the cumulative timespent and not within the specified work log date. 

Are you sure it works at your end or am I missing something?

Lot of other threads indicate additional plugins like Tempo for such use-cases

Like Tom Hawkins likes this
Tom Hawkins February 9, 2022

Hello Jagadeesh, I've just rerun a new version of the same link (https this time, fixed that since previous comment) for a user of ours who has worked on several other issues since the specified time period and it only gives results for issues with worklogs from the specified time period 
https:// {YOUR JIRA ADDRESS}  /rest/api/2/search?jql=worklogAuthor= {THE USERNAME OF THE USER BEING QUERIED}  %20and%20worklogDate%20%3E%202021-09-26%20and%20worklogDate%20%3C%202021-10-04%20and%20timespent%20%3E%200&fields=summary,worklog&maxResults=1000 

I'm not saying don't go for additional plugins if they suit you, likely to be better than this solution, but in our case we weren't keen on additional plugin cost at this time given planning to move from Jira Server to Jira Cloud soon anyway, so it's working ok as a temporary workaround. 

Like Jagadeesh Rangaswamy likes this
Jagadeesh Rangaswamy February 9, 2022

I'm also on the same boat - of no additional plugins and the requirement is simpler.

However, we are already on JIRA cloud and I can confirm that it is not working i.e. it is pulling cumulative timespent and not just the given time-period.

Not sure if this is a bug only on JIRA cloud, may be?

Suggest an answer

Log in or Sign up to answer