<commit_before>Ext.define('CustomApp', {
    extend: 'Rally.app.App',
    componentCls: 'app',
    launch: function() {
      console.log("First Rally app");
      console.log("what is this=", this.__proto__.$className)
      var rallyApp = this;
      var myStore1 = Ext.create('Rally.data.wsapi.Store', {
          model: 'User Story',
          autoLoad: true,
          listeners: {
              load: function(myStore, myData, success) {
                  console.log('Data read!', myStore, myData, success);

                  var myGrid = Ext.create('Rally.ui.grid.Grid', {
                    store: myStore,
                    enableHierarchy: true,
                    columnCfgs: ['FormattedID', 'Name', 'Description', 'PlanEstimate', 'ScheduleState']
                  });

                  console.log('My Grid', myGrid);
                  //This only works in conjunction with the scope: this instruction
                  //this.add(myGrid);
                  //This is muuuch better
                  rallyApp.add(myGrid);
                  //Trick: Always add this line so you know the current context object
                  console.log('what is this=', this.__proto__.$className)
              },
              //Trick: this is set during store creation, so the current this is the app.
              //If you forget this, the this.add(myGrid) will refer to the store - context
              //is switched after the store is created
              //The other, cleaner way to do it is to create a variable that references the app
              //at the time of creation - the example
              //scope: this
          },
          fetch: ['FormattedID', 'Name', 'Description','PlanEstimate', 'ScheduleState']
      });
    }
});<commit_msg>Refactored App.js<commit_after>var rallyApp;
Ext.define('CustomApp', {
    extend: 'Rally.app.App',
    componentCls: 'app',

    launch: function(){
      console.log("First Rally app");
      console.log("what is this=", this.__proto__.$className)
      rallyApp = this;
      rallyApp._loadData();
    },
    _loadData: function(){
      var myStore1 = Ext.create('Rally.data.wsapi.Store', {
          model: 'User Story',
          autoLoad: true,
          listeners: {
              load: function(myStore, myData, success) {
                console.log('Data read!', myStore, myData, success);
                rallyApp._loadGrid(myStore);
              },
          },
          fetch: ['FormattedID', 'Name', 'Description','PlanEstimate', 'ScheduleState']
      });
    },
    _loadGrid: function(store){
      var myGrid = Ext.create('Rally.ui.grid.Grid', {
        store: store,
        enableHierarchy: true,
        columnCfgs: ['FormattedID', 'Name', 'Description', 'PlanEstimate', 'ScheduleState']
      });

      console.log('My Grid', myGrid);
      //This only works in conjunction with the scope: this instruction
      //this.add(myGrid);
      //This is muuuch better
      rallyApp.add(myGrid);
      //Trick: Always add this line so you know the current context object
      console.log('what is this=', this.__proto__.$className)
    }
});
{'fraction_non_alphanumeric': 0.12432086928731224, 'fraction_numerical': 0.0006391818472355385, 'mean_word_length': 1.9500471253534402, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1897819', 'n_tokens_mistral': 862, 'n_tokens_neox': 846, 'n_words': 242}