<commit_before>// Module for MLB scores
const moment = require('moment-timezone');

module.exports = 
{

  name: "MLB",

  teamsToFollow:[],

  configure: function(config) {
    this.teamsToFollow = config.teams;
  },

  getUrl: function(date) {
    var d = moment(date);

    //save this for later explicit comparison against the result set.
    this.lastPullDate = d;

    var url = "http://gd2.mlb.com/components/game/mlb/year_" + d.format('YYYY') +
    "/month_" + d.format('MM') +
    "/day_" + d.format('DD') + 
    "/master_scoreboard.json";

    return url;
  },
  
  getInningSection: function(i) {
    switch(i) {
      case "Top":
        return "TOP";
        break;
      case "Middle":
        return "MID";
        break;
      case "Bottom":
        return "BOT";
        break;
      case "End":
        return "END";
        break;
      default:
        return i;
        break;
    }
  },

  getOrdinal: function(i) {
    var j = i % 10,
      k = i % 100;
    if (j == 1 && k != 11) {
      return i + "<sup>ST</sup>";
    }
    if (j == 2 && k != 12) {
      return i + "<sup>ND</sup>";
    }
    if (j == 3 && k != 13) {
      return i + "<sup>RD</sup>";
    }
    return i + "<sup>TH</sup>";
  },

  processData: function(data) {

    //expects JSON
    data = JSON.parse(data);

    var self = this;
    var formattedGamesList = new Array();

    if (data.data.games && data.data.games.game) {


      data.data.games.game.forEach( function(game) {

        /*
          Only process and add games that match the list of teams to follow as well as match
          the last date provided to the getUrl function (ie.: explicit match on game date).
          This is because sometimes the MLB feed has games from the wrong date even though
          the request queries for a specific date.
        */
        if ( (self.teamsToFollow.indexOf(game.home_name_abbrev) != -1 || 
                self.teamsToFollow.indexOf(game.away_name_abbrev) != -1) &&
              self.lastPullDate.startOf("day").isSame(moment(game.original_date, "YYYY-MM-DD").startOf("day")) ) {

            var gameState;
            var classes = [];
            var status = [];

<commit_msg>undid previous change.  It broke stuff<commit_after>// Module for MLB scores
const moment = require('moment-timezone');

module.exports = 
{

  name: "MLB",

  teamsToFollow:[],

  configure: function(teams) {
    this.teamsToFollow = teams;
  },

  getUrl: function(date) {
    var d = moment(date);
    var url = "http://gd2.mlb.com/components/game/mlb/year_" + d.format('YYYY') +
    "/month_" + d.format('MM') +
    "/day_" + d.format('DD') + 
    "/master_scoreboard.json";

    return url;
  },
  
  getInningSection: function(i) {
    switch(i) {
      case "Top":
        return "TOP";
        break;
      case "Middle":
        return "MID";
        break;
      case "Bottom":
        return "BOT";
        break;
      case "End":
        return "END";
        break;
      default:
        return i;
        break;
    }
  },

  getOrdinal: function(i) {
    var j = i % 10,
      k = i % 100;
    if (j == 1 && k != 11) {
      return i + "<sup>ST</sup>";
    }
    if (j == 2 && k != 12) {
      return i + "<sup>ND</sup>";
    }
    if (j == 3 && k != 13) {
      return i + "<sup>RD</sup>";
    }
    return i + "<sup>TH</sup>";
  },

  processData: function(data) {

    //expects JSON
    data = JSON.parse(data);

    var self = this;
    var formattedGamesList = new Array();

    if (data.data.games && data.data.games.game) {


      data.data.games.game.forEach( function(game) {


        if (self.teamsToFollow.indexOf(game.home_name_abbrev) != -1 || 
          self.teamsToFollow.indexOf(game.away_name_abbrev) != -1) {

            var gameState;
            var classes = [];
            var status = [];


{'fraction_non_alphanumeric': 0.1532426778242678, 'fraction_numerical': 0.00889121338912134, 'mean_word_length': 1.9582366589327147, 'pattern_counts': {'":': 8, '<': 19, '<?xml version=': 0, '>': 19, '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': '3171449', 'n_tokens_mistral': 1342, 'n_tokens_neox': 1253, 'n_words': 320}