<commit_before>const async = require('async');
const db = require('../store/db');
const utility = require('../util/utility');
const queries = require('../store/queries');

const { invokeInterval } = utility;

function doTeams(cb) {
  db.raw('select distinct team_id from team_match').asCallback((err, result) => {
    if (err) {
      return cb(err);
    }
    return async.eachSeries(result.rows, (m, cb) => {
      if (!m.team_id) {
        return cb();
      }
      // GetTeamInfo disabled as of october 2017
      /*
      const container = utility.generateJob('api_teams', {
        // 2 is the smallest team id, use as default
        team_id: m.team_id || 2,
      });
      */
      const container = utility.generateJob('api_team_info_by_team_id', {
        start_at_team_id: m.team_id,
      });
      return utility.getData({ url: container.url, raw: true }, (err, body) => {
        if (err) {
          return cb(err);
        }
        const raw = body;
        body = JSON.parse(body);
        if (!body.result || !body.result.teams) {
          return cb();
        }
        const t = body.result.teams[0];
        // The logo value is a 64 bit integer which is too large to represent in JSON<commit_msg>fetch team data in descending order<commit_after>const async = require('async');
const db = require('../store/db');
const utility = require('../util/utility');
const queries = require('../store/queries');

const { invokeInterval } = utility;

function doTeams(cb) {
  db.raw('select distinct team_id from team_match order by team_id desc').asCallback((err, result) => {
    if (err) {
      return cb(err);
    }
    return async.eachSeries(result.rows, (m, cb) => {
      if (!m.team_id) {
        return cb();
      }
      // GetTeamInfo disabled as of october 2017
      /*
      const container = utility.generateJob('api_teams', {
        // 2 is the smallest team id, use as default
        team_id: m.team_id || 2,
      });
      */
      const container = utility.generateJob('api_team_info_by_team_id', {
        start_at_team_id: m.team_id,
      });
      return utility.getData({ url: container.url, raw: true }, (err, body) => {
        if (err) {
          return cb(err);
        }
        const raw = body;
        body = JSON.parse(body);
        if (!body.result || !body.result.teams) {
          return cb();
        }
        const t = body.result.teams[0];
        // The logo value is a 64 bit integer which is too large to represent in JSON
{'fraction_non_alphanumeric': 0.13906752411575563, 'fraction_numerical': 0.007234726688102894, 'mean_word_length': 2.275, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '1719550', 'n_tokens_mistral': 773, 'n_tokens_neox': 757, 'n_words': 212}