在投资组合项目的特定日期获取故事点

时间:2016-03-04 20:55:50

标签: javascript rally lookbackapi

您好我希望在特定日期从多程序项目中获取接受的故事点。在这种情况下,我想回到去年。为什么我没有获得任何已接受上一年SP的快照数据?

这是我目前的代码,它不能让我回复上一年接受的SP:

_loadMP: function() {
     var mpEpics = Ext.create('Rally.data.wsapi.artifact.Store', {
            models: ['PortfolioItem/multiprogramepic'],
            fetch: ['FormattedID', 'Name', 'Owner', 'LeafStoryPlanEstimateTotal', 'AcceptedLeafStoryPlanEstimateTotal', 'PercentDoneByStoryPlanEstimate', 'PlannedStartDate', 'PlannedEndDate',  'Children'],
            autoLoad: true,
            limit: Infinity,
            pageSize: 9999,         
        });

        mpEpics.load().then({
            success: this._MPLoaded,
            scope: this
        });
    },

_MPLoaded: function(items) {
    var me = this;
    _.each(items, function(item) {
    me._calculatePreviousYear(item.get("ObjectID"), item.get("PlannedStartDate"), item.get("PlannedEndDate"));
},

_calculatePreviousYear: function(objID, startDate, endDate){
    var currentYear = Rally.util.DateTime.format(startDate, 'Y');
    var prevYear = new Date();
    prevYear.setFullYear(currentYear, 0, 1);
    prevYear.setHours(0, 0, 1); 
       var projectStore = Ext.create('Rally.data.lookback.SnapshotStore', {
            find: {
                _TypeHierarchy: {
                    '$in': ['HierarchicalRequirement']
                },
                _ItemHierarchy: objID,
                _ValidFrom: {
                    "$gte": startDate,
                    "$lte": prevYear
                },
            },
            fetch: ['FormattedID'],
            hydrate: ['Project'],
            sort: {
                "_ValidFrom": 1
            },
            limit: Infinity,
            context: this.getContext().getDataContext(),
            removeUnauthorizedSnapshots: true
        });

        console.log(objID, projectStore);
    }

1 个答案:

答案 0 :(得分:0)

回顾api的_ValidFrom和_ValidTo字段是字符串,因此可能只需要使用Rally.util.DateTime.toIsoString()包装startDate和prevYear值。不确定代码是否具有代表性或实际工作代码,但看起来您在_MPLoaded中缺少可能影响进度的}。