<commit_before>var peRecords = [];
var acceptedData = [];

Ext.define("MyBurnCalculator", {
   extend: "Rally.data.lookback.calculator.TimeSeriesCalculator",
   
    getMetrics: function () {
        var metrics = [
           {
               field: "LeafStoryPlanEstimateTotal",
               as: "Planned Points",
               display: "line",
               f: "sum",
           },
           {
               field: "CalcPreliminaryEstimate",
               as: "PreliminaryEstimate",
               display: "line",
               f: "sum",
           },
           {
               field: "AcceptedLeafStoryPlanEstimateTotal",
               as: "Accepted Points",
               display: "line",
               f: "sum",
           },
            {
               field: "ObjectID",
               as: "Count",
               display: "column",
               f: "count"
            },
            {
               field: "Completed",
               as: "Completed",
               display: "column",
               f: "sum"
            }
       ];
        return metrics;
    },
    getDerivedFieldsOnInput : function () { 
        // XS 1, S 3, M 5, L 8, XL 13
        return [ 
            {
                as: 'CalcPreliminaryEstimate', 
                f:  function(row) {
                    var r = _.find(peRecords, function(rec) { return rec.get("ObjectID") == row["PreliminaryEstimate"] });
                    return r != undefined ? r.get("Value") : 0;    
                }
            },
            {
                as: 'Completed', 
                f:  function(row) {
                return row['PercentDoneByStoryCount'] == 1 ? 1 : 0;
                }
            }
        ];
    },
    getDerivedFieldsAfterSummary : function () {
        return [
            {as: 'Projection', 
            f: function (row, index, summaryMetrics, seriesData) {
                if (index == 0) {
                    //console.log(seriesData);
                    datesData = _.pluck(seriesData,"label");
                    acceptedData = _.pluck(seriesData,"Accepted Points");
                    console.log("accepted date len",acceptedData.length);
                    var today = new Date();
                    acceptedData = _.filter(acceptedData, function(d,i){ return new Date(Date.parse(datesData[i])) < today;   });
                    //console.log(acceptedData);
                }
                var y = linearProject( acceptedData, index);
                return Math.round(y * 100) / 100;
            }
          } 
        ];
    },
   defined : function(v) {
        return (!_.isUndefined(v) && !_.isNull(v));            
    }
   
});



Ext.define('CustomApp', {
    scopeType: 'release',
    extend: 'Rally.app.App',
    componentCls: 'app',

    launch: function() {
        console.log("launch");

        var timeboxScope = this.getContext().getTimeboxScope();
        var tbName = null;
        if(timeboxScope) {
            var record = timeboxScope.getRecord();
            tbName = record.get('Name');
        } else {
            tbName = "";
        }
        
        var peStore = Ext.create('Rally.data.WsapiDataStore', {
            autoLoad: true,
            model: 'PreliminaryEstimate',
            fetch: ['Name', 'ObjectID', 'Value'],
            filters: [],
            listeners: {
                scope : this,
                load: function(store, data) {       
                    peRecords = data;
                    this.queryReleases(tbName);
                }
            }
        });
    },
    
    queryReleases : function(name) {
    
        var releaseStore;
        return releaseStore = Ext.create('Rally.data.WsapiDataStore', {
        autoLoad: true,
        model: 'Release',
        limit : 'Infinity',
        fetch: ['Name', 'ObjectID', 'Project', 'ReleaseStartDate', 'ReleaseDate' ],
        filters: [],
        listeners: {
        load: function(store, releaseRecords) {

            // given a list of all releases (accross sub projects)
            var releases = _.map( releaseRecords, function(rec) { return { name : rec.get("Name"), objectid : rec.get("ObjectID"), releaseDate : new Date(Date.parse(rec.get("ReleaseDate")))};});
            
            releases = _.sortBy( releases, function(rec) {return rec.releaseDate;}).reverse();
            console.log("releases:",releases);
            
            // get a unique list by name to display in combobox        
            releases = _.uniq( releases, function (r) { return r.name; });
            // create a store with the set of unique releases
            var releasesStore = Ext.create('Ext.data.Store', {
                fields: ['name','objectid'],data : releases 
            });
          
            // construct the combo box using the store
            var cb = Ext.create("Ext.ux.CheckCombo", {
                fieldLabel: 'Release',
                store: releasesStore,
                queryMode: 'local',
                displayField: 'name',<commit_msg>Handle more than 200 releases.<commit_after>var peRecords = [];
var acceptedData = [];

Ext.define("MyBurnCalculator", {
   extend: "Rally.data.lookback.calculator.TimeSeriesCalculator",
   
    getMetrics: function () {
        var metrics = [
           {
               field: "LeafStoryPlanEstimateTotal",
               as: "Planned Points",
               display: "line",
               f: "sum",
           },
           {
               field: "CalcPreliminaryEstimate",
               as: "PreliminaryEstimate",
               display: "line",
               f: "sum",
           },
           {
               field: "AcceptedLeafStoryPlanEstimateTotal",
               as: "Accepted Points",
               display: "line",
               f: "sum",
           },
            {
               field: "ObjectID",
               as: "Count",
               display: "column",
               f: "count"
            },
            {
               field: "Completed",
               as: "Completed",
               display: "column",
               f: "sum"
            }
       ];
        return metrics;
    },
    getDerivedFieldsOnInput : function () { 
        // XS 1, S 3, M 5, L 8, XL 13
        return [ 
            {
                as: 'CalcPreliminaryEstimate', 
                f:  function(row) {
                    var r = _.find(peRecords, function(rec) { return rec.get("ObjectID") == row["PreliminaryEstimate"] });
                    return r != undefined ? r.get("Value") : 0;    
                }
            },
            {
                as: 'Completed', 
                f:  function(row) {
                return row['PercentDoneByStoryCount'] == 1 ? 1 : 0;
                }
            }
        ];
    },
    getDerivedFieldsAfterSummary : function () {
        return [
            {as: 'Projection', 
            f: function (row, index, summaryMetrics, seriesData) {
                if (index == 0) {
                    //console.log(seriesData);
                    datesData = _.pluck(seriesData,"label");
                    acceptedData = _.pluck(seriesData,"Accepted Points");
                    console.log("accepted date len",acceptedData.length);
                    var today = new Date();
                    acceptedData = _.filter(acceptedData, function(d,i){ return new Date(Date.parse(datesData[i])) < today;   });
                    //console.log(acceptedData);
                }
                var y = linearProject( acceptedData, index);
                return Math.round(y * 100) / 100;
            }
          } 
        ];
    },
   defined : function(v) {
        return (!_.isUndefined(v) && !_.isNull(v));            
    }
   
});



Ext.define('CustomApp', {
    scopeType: 'release',
    extend: 'Rally.app.App',
    componentCls: 'app',

    launch: function() {
        console.log("launch");

        var timeboxScope = this.getContext().getTimeboxScope();
        var tbName = null;
        if(timeboxScope) {
            var record = timeboxScope.getRecord();
            tbName = record.get('Name');
        } else {
            tbName = "";
        }
        
        var peStore = Ext.create('Rally.data.WsapiDataStore', {
            autoLoad: true,
            model: 'PreliminaryEstimate',
            fetch: ['Name', 'ObjectID', 'Value'],
            filters: [],
            listeners: {
                scope : this,
                load: function(store, data) {       
                    peRecords = data;
                    this.queryReleases(tbName);
                }
            }
        });
    },
    
    queryReleases : function(name) {
    
        var releaseStore;
        return releaseStore = Ext.create('Rally.data.WsapiDataStore', {
        autoLoad: true,
        model: 'Release',
        limit : 'Infinity',
        fetch: ['Name', 'ObjectID', 'Project', 'ReleaseStartDate', 'ReleaseDate' ],
        filters: [],
        listeners: {
        load: function(store, releaseRecords) {

            // given a list of all releases (accross sub projects)
            var releases = _.map( releaseRecords, function(rec) { return { name : rec.get("Name"), objectid : rec.get("ObjectID"), releaseDate : new Date(Date.parse(rec.get("ReleaseDate")))};});
            
            releases = _.sortBy( releases, function(rec) {return rec.releaseDate;}).reverse();
            //console.log("releases:",releases);
            
            // get a unique list by name to display in combobox        
            releases = _.uniq( releases, function (r) { return r.name; });
            // create a store with the set of unique releases
            var releasesStore = Ext.create('Ext.data.Store', {
                fields: ['name','objectid'],data : releases 
            });
          
            // construct the combo box using the store
            var cb = Ext.create("Ext.ux.CheckCombo", {
                fieldLabel: 'Release',
                store: releasesStore,
                queryMode: 'local',
                displayField: 'name',
{'fraction_non_alphanumeric': 0.12404409573939815, 'fraction_numerical': 0.003674644949846062, 'mean_word_length': 1.3605250820440693, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5569647', 'n_tokens_mistral': 2717, 'n_tokens_neox': 2569, 'n_words': 583}