使用 Rally API 根据功能选择用户故事 [英] Select User stories based on feature using Rally API

查看:39
本文介绍了使用 Rally API 根据功能选择用户故事的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取属于某个功能但有子项的所有用户故事.

I'm trying to fetch all user stories that belong to certain feature, but which have children.

以下是我使用rally-node 为其创建查询的方法.

Here's how I created query for that using rally-node.

async.map(features, function(feature, cb) {
  self.restApi.query({
      type: 'hierarchicalrequirement',
      limit: Infinity,
      order: 'Rank',
      fetch: ['FormattedID', 'Name', 'Children'],
      parent: feature.ObjectID,
      query: queryUtils.where('DirectChildrenCount', '>', 0)
 }, cb);
}, function(err, results) {
   //user stories
});

这是我的功能的样子:

 { _rallyAPIMajor: '2',
_rallyAPIMinor: '0',
_ref: 'https://rally1.rallydev.com/slm/webservice/v2.0/portfolioitem/feature/18846103932',
_refObjectUUID: 'c01d7f828-a6d6-4efc-8160-c0c19ad0fabc',
_objectVersion: '7',
_refObjectName: 'Dashboard Widgets',
ObjectID: 18836103932,
FormattedID: 'F1',
DirectChildrenCount: 2,
Name: 'Dashboard Widgets',
UserStories: 
 { _rallyAPIMajor: '2',
   _rallyAPIMinor: '0',
   _ref: 'https://rally1.rallydev.com/slm/webservice/v2.0/PortfolioItem/Feature/18846103932/UserStories',
   _type: 'HierarchicalRequirement',
   Count: 2 },
_type: 'PortfolioItem/Feature' },

我是集会的新手,因此非常感谢任何有关文档等方面的进一步帮助.

I'm new to rally, so any further help regardind documentation, etc, is really appreciated.

推荐答案

这里是一个完整的示例,其中 Feature 被查询,它的 UserStories 集合被提取,然后被水合.

Here is a full example where Feature is queried and its UserStories collection is fetched and then hydrated.

v2.0 出于性能原因删除了在同一响应中返回子集合的功能.现在获取一个集合将返回一个带有计数和从中获取集合数据的 url 的对象.需要单独的请求来对集合进行水合.

v2.0 removed the ability to return child collections in the same response for performance reasons. Now fetching a collection will return an object with the count and the url from which to get the collection data. Separate request is needed to hydrate a collection.

此更改记录在此处

我在您的帖子中没有看到问题,我不确定您遇到什么问题,但是他的代码根据功能获取用户故事,通过 ('DirectChildrenCount', '>', 0)

I do not see a question in your post, I am not sure what problem you encounter, but his code gets user stories based on feature, filtered by ('DirectChildrenCount', '>', 0)

var rally = require('rally'),
    queryUtils = rally.util.query;
    mySettings = {
        apiKey: '_secret',
        server: 'https://rally1.rallydev.com',  //this is the default and may be omitted
        requestOptions: {
            headers: {
                'X-RallyIntegrationName': 'My cool node.js program',  
                'X-RallyIntegrationVendor': 'My company',             
                'X-RallyIntegrationVersion': '1.0'                    
            },
        }
    },
    restApi = rally(mySettings);

function queryFeature() {
    return restApi.query({
        type: 'portfolioitem/feature',
        fetch: ['FormattedID', 'Name', 'UserStories'],
        query: queryUtils.where('FormattedID', '=', 'F7')
    });
}

function queryChildren(result) {
    return restApi.query({
        ref: result.Results[0].UserStories,
        limit: Infinity,
        order: 'Rank',
        fetch: ['FormattedID', 'Name'],
        query: queryUtils.where('DirectChildrenCount', '>', 0)
    });
}

function onSuccess(result) {
    console.log('Success!', result);
}

function onError(errors) {
    console.log('Failure!', errors);
}

queryFeature()
    .then(queryChildren)
    .then(onSuccess)
    .fail(onError);

这篇关于使用 Rally API 根据功能选择用户故事的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆