1

嗨,我想在特定日期从多程序项目中获得接受的故事点。在这种情况下,我想回到前一年。为什么我没有收到上一年接受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);
    }
4

1 回答 1

0

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

于 2016-03-07T15:07:25.047 回答