0

I'm trying to find some stats about defects in version one but the reporting and API are getting the type of data I need.

I'm trying to find how long defects sat in a "ready" status and how long defect took to move from "developing" to "testing". I also only want to get it for a subset of the team so I can compare individual developers. I've been trying to get the history of changes for defects but I'm not about to find the detail status.

v1.Scope.where(Name='My Project')
v.first().Workitems[0].History[0].ChangedBy.Name
v.first().Workitems[0].History[0].ChangeDateUTC
// need details status

Is there any way to get the status change so i can compare the difference between dates? Would this be easier in the reporting tool?

puppybits
  • 1,110
  • 12
  • 16

1 Answers1

0

There is not a predefined attribute for status changes. Therefore, the time-in-status value must be calculated using the attribute definition syntax. We can use the History attribute, filtered by the status of interest, and sum up the days. For example, to calculate the time in Ready:

History[Status.Name='Ready'].Days.@Sum

When you say you want to calculate the time it took to move from Developing to Testing, I assume you mean there is something like Ready for Test (if not, then the answer is just like the above only using Developing as the filter). The following shows the cycle time across multiple statuses (don't include the end status of Testing or you get how long it stayed there too):

History[Status.Name='Developing','Ready for Test'].Days.@Sum

You can use the query.v1 endpoint to POST the following query:

from: Defect
where:
  Scope.Name: My Project
select:
  - Name
  - Status
  - ChangeDateUTC
  - ChangedBy.Name
  - History[Status.Name='Ready'].Days.@Sum

Or, using the rest-1.v1/Data endpoint, you can GET the following query (newlines added for readability):

<Server Base URI>/rest-1.v1/Data/Defect
    ?where=Scope.ParentMeAndUp.Name='My%20Project'
    &sel=Name,Status,ChangeDateUTC,ChangedBy.Name,History[Status.Name='Ready'].Days.@Sum

I'm not familiar with the syntax you posted. Is it from Python.SDK?

ian.buchanan
  • 314
  • 1
  • 10