How to query for state transitions?

主宰稳场 提交于 2019-12-18 09:15:34

问题


I want to get defects that were transitioned from one state to another (for example Submitted to Fixed) within certain dates. I see that information in the revision history of the defect. In your WS API it says that revisions cannot be queried.


回答1:


Here is an example of LookbackAPI query that looks for defects whose state was changed from Submitted (and higher) to Fixed within a certain timeframe:

https://rally1.rallydev.com/analytics/v2.0/service/rally/workspace/12352608129/artifact/snapshot/query.js?find={"State":"Fixed","_PreviousValues.State":{$gte:"Submitted"},_ValidFrom:{$gte:"2013-06-01TZ",$lt:"2013-07-011TZ"}},sort:{_ValidFrom:-1}}&fields=true&hydrate=["_PreviousValues","State"]&pagesize:20

Lookback API allows to see what any work item or collection of work items looked like in the past. This is different from using WS API directly, which can provide you with the current state of objects, but does not have historical data.

LBAPI documentation is available here

On a side note, it is possible to get state transition data in a custom app without using LBAPI if you query on defects and fetch RevisionHistory,Revisions and Description, and iterate over results parsing Description of individual revisions for "STATE changed" string:

if(results.mydefects[i].RevisionHistory.Revisions[j].Description.indexOf("STATE changed")>=0){ //....

but it can be expensive and inefficient. If you decide to do that please narrow the scope of your defect query.



来源:https://stackoverflow.com/questions/17599988/how-to-query-for-state-transitions

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!