0

我正在执行以下回顾快照。我取回了数据,但我还需要已完成记录的 ValidFrom 日期。它不是 _PreviousValues 记录的一部分。我怎样才能让我的查询回来?

谢谢!

find: {
                '_TypeHierarchy': 'HierarchicalRequirement',
                'Children':null,'ScheduleState':'Accepted',
                '_PreviousValues.ScheduleState':'Completed',
                '_ValidFrom': { '$gte':startDate},
                '_ValidTo': { '$lte': endDate},
             },
            fetch: ['FormattedID','Name','_ValidFrom','_ValidTo','BlockedReason','_User','WorkProduct','ScheduleState','_PreviousValues.ScheduleState','AcceptedDate'], 
           // order: 'OpenedDate DESC',
            hydrate: ['FormattedID','Name','_ValidFrom','_ValidTo','BlockedReason','_User','WorkProduct','ScheduleState','_PreviousValues.ScheduleState','AcceptedDate'],
            compress: true,
4

1 回答 1

0

看起来我们需要的是类似的东西_PreviousValues.ScheduleState._ValidFrom,但它不存在。

我认为不可能从同一个查询中获取_ValidFrom值,需要单独的查询。_PreviousValues.ScheduleState

例如,这个查询:

https://rally1.rallydev.com/analytics/v2.0/service/rally/workspace/1234/artifact/snapshot/query.js?find={"Project":5678,"_TypeHierarchy":"HierarchicalRequirement","ScheduleState":"Accepted", "_PreviousValues.ScheduleState": "Completed"}&fields=["ObjectID","_ValidFrom","_ValidTo","ScheduleState","_PreviousValues.ScheduleState"]&hydrate=["ScheduleState","_PreviousValues.ScheduleState"]&compress=true

将返回仅包含状态值的 _PreviousValues 对象:

_PreviousValues: {
ScheduleState: "Completed"
}

假设其中一个结果的 ObjectID 为 777。

第二个查询将使用第一个查询结果的 ObjectID(s) 来获取故事处于“已完成”状态的时间间隔:

https://rally1.rallydev.com/analytics/v2.0/service/rally/workspace/1234/artifact/snapshot/query.js?find={"ObjectID":777,"ScheduleState": "Completed","_PreviousValues.ScheduleState": "In-Progress"}&fields=["ObjectID","_ValidFrom","_ValidTo","ScheduleState"]&hydrate=["ScheduleState"]

它可能会返回多个快照,并且根据获取的字段,可能不会指示这些快照之间发生了什么变化(例如,在本例中为 TaskStatus 和 TaskRemainingTotal),但无论如何最早的快照_ValidFrom_ValidFrom: "2013-06-17T18:51:36.931Z"是您正在查看的日期为了

Results: 
[
{
_ValidFrom: "2013-06-17T18:51:36.931Z",
_ValidTo: "2013-06-17T18:51:44.382Z",
ObjectID: 12353154323,
ScheduleState: "Completed"
},
{
_ValidFrom: "2013-06-17T18:55:50.897Z",
_ValidTo: "2013-06-18T20:53:01.755Z",
ObjectID: 12353154323,
ScheduleState: "Completed"
}
]

如果您正在编写代码,您将获得_ValidFrom对象数组的第一个元素。

于 2014-10-24T21:32:38.363 回答