Iteration.StartDate不可用

时间:2016-09-22 20:43:19

标签: rally

当我使用Rally.data.WsapiDataStore查询用户故事时,我可以检索Iteration.StartDate和Iteration.EndDate。但是,当我使用.getCollection('Predecessors')加载集合时,会加载迭代名称,但不会填充StartDate和EndDate。应用程序代码写入控制台以检查迭代对象。

<!DOCTYPE html>
<html>
<head>
    <title>Rally</title>

    <script type="text/javascript" src="/apps/2.0rc3/sdk.js"></script>

    <script type="text/javascript">
        Rally.onReady(function () {
                Ext.define('CustomApp', {
  extend: 'Rally.app.App',

  launch: function() {
    MyApp = this;

    MyApp.globalContext = this.getContext().getDataContext();
    MyApp.PredecessorSearch = [];

    Ext.getBody().mask('Loading...' );

    // Update the filter
    var filter = Ext.create('Rally.data.QueryFilter', {
      property: 'DirectChildrenCount',
      operator: '=',
      value: '0'
    });

    var filter2 = Ext.create('Rally.data.QueryFilter', {
      property: 'ScheduleState',
      operator: '!=',
      value: 'Accepted'
    });

    filter = filter.and( filter2 );

    Ext.create('Rally.data.WsapiDataStore', {
      autoLoad: true,
      limit: Infinity,
      model: 'UserStory',
      context: MyApp.globalContext,
      fetch: ['Feature', 'Parent', 'Children',
              'FormattedID', 'Name', 
              'ScheduleState', 'c_DevKanban',
              'Release', 'Iteration', 'StartDate', 'EndDate', 
              'Blocked', 'BlockedReason', 
              'Predecessors',
              'Owner','ObjectID' ],
      filters: [ filter ],
      sorters: [{
        property: 'Rank',
        direction: 'ASC'
      }],
      listeners: {
        load: function (store, records) {
          Ext.each(records, function(record) {
            record.data.PredecessorData = [];

            console.log( "Story " + record.data.FormattedID, record.data.Iteration );

            // Look for predecessors
            //console.log( record.data.Predecessors );
            if ( record.data.Predecessors && 
                 record.data.Predecessors.Count > 0 ) {
              MyApp._loadPredecessorsInStory( record );
            }
            // End of look for associated predecessors
          });

          var wait = function(condFunc, readyFunc, checkInterval) {
            var checkFunc = function() {
              if( condFunc() ) { readyFunc(); }
              else             { setTimeout(checkFunc, checkInterval); }
            };
            checkFunc();
          };

          MyApp.PredecessorSearch.push( 'END' );

          wait(
            function() { 
              return ( MyApp.PredecessorSearch[0] == 'END' ); 
            }, 
            function() { 
              Ext.getBody().unmask();
            },
            1000
          );
        }
      }
    });
  },

  _loadPredecessorsInStory: function ( userStory ) {
    // Add this user story to the end of the list
    MyApp.PredecessorSearch.push( userStory.data.FormattedID );

    userStory.getCollection('Predecessors').load({
      scope: this,
      autoLoad: true,
      limit: Infinity,
      context: MyApp.globalContext,
      fetch: ['Requirement',
              'FormattedID', 'Name', 
              'State', 'ScheduleState', 'c_DevKanban',
              'Release', 'Iteration', 'StartDate', 'EndDate', 
              'Blocked', 'BlockedReason', 
              'Owner','ObjectID' ],
      filters: [ {
        property: 'ScheduleState',
        operator: '!=',
        value: 'Accepted' }
      ],
      callback: function(records, operation, success){
        Ext.Array.each(records, function(record){
          console.log( "Predecessor " + record.data.FormattedID, record.data.Iteration );
        });

        // Remove this user story from the front of the list
        MyApp._removeElement( MyApp.PredecessorSearch, userStory.data.FormattedID );
      }
    });
  },

  _removeElement: function( array, element ) {
    for(var i = array.length - 1; i >= 0; i--) {
      if(array[i] === element) {
        array.splice(i, 1);
        return true;
      }
    }  

    return false;
  }
});


            Rally.launchApp('CustomApp', {
                name:"Rally",
                parentRepos:""
            });

        });
    </script>


</head>
<body>
</body>
</html>

2 个答案:

答案 0 :(得分:1)

我似乎记得这是使用getCollection方法的2.0rc3版本中的错误。如果您在config参数中传递fetch而不是将其传递给加载怎么办?

userStory.getCollection('Predecessors', {
    fetch: ['Iteration', 'StartDate', 'EndDate', etc...]
}).load()...

您还可以尝试升级到更新的SDK版本2.0或最新的2.1 ...

答案 1 :(得分:0)

我很担心你是否期待&#34; StartDate&#34;和&#34; EndDate&#34;要填充的fetch []中定义的字段,或者是否期望填充Iteration.EndDate和Iteration.StartDate。第一个不存在于用户故事(这是getCollection将要返回的类型)上,它们仅存在于迭代类型上。

我认为KyleM指的是为类型提取的默认字段,除非你用另一个列表覆盖列表 - 我不知道如果提取的项目是getCollection的一部分(这将采取配置你指定,而不是将其传递给迭代数据的提取)

相关问题