How to use the dotaconstants.patch function in dotaconstants

To help you get started, we’ve selected a few dotaconstants examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github odota / core / util / utility.js View on Github external
function getPatchIndex(startTime) {
  const date = new Date(startTime * 1000);
  let i;
  for (i = 1; i < constants.patch.length; i += 1) {
    const pd = new Date(constants.patch[i].date);
    // stop when patch date is past the start time
    if (pd > date) {
      break;
    }
  }
  // use the value of i before the break, started at 1 to avoid negative index
  return i - 1;
}
github odota / core / util / utility.js View on Github external
function getPatchIndex(startTime) {
  const date = new Date(startTime * 1000);
  let i;
  for (i = 1; i < constants.patch.length; i += 1) {
    const pd = new Date(constants.patch[i].date);
    // stop when patch date is past the start time
    if (pd > date) {
      break;
    }
  }
  // use the value of i before the break, started at 1 to avoid negative index
  return i - 1;
}
github odota / core / dev / rePatch.js View on Github external
async.eachSeries(matchIds, (match, cb) => {
    console.log(match.match_id);
    queries.upsert(
      db, 'match_patch',
      {
        match_id: match.match_id,
        patch: constants.patch[utility.getPatchIndex(match.start_time)].name,
      },
      {
        match_id: match.match_id,
      }, cb,
    );
  }, (err) => {
    process.exit(Number(err));
github odota / core / svc / repatch.js View on Github external
async.eachSeries(matchIds, (match, cb) => {
      queries.upsert(
        db, 'match_patch',
        {
          match_id: match.match_id,
          patch: constants.patch[utility.getPatchIndex(match.start_time)].name,
        },
        {
          match_id: match.match_id,
        }, cb,
      );
    }, (err) => {
      console.error(err);
github odota / core / store / queries.js View on Github external
function upsertMatchPatch(cb) {
        if (match.start_time) {
          return upsert(trx, 'match_patch', {
            match_id: match.match_id,
            patch: constants.patch[utility.getPatchIndex(match.start_time)].name,
          }, {
            match_id: match.match_id,
          }, cb);
        }
        return cb();
      }
github odota / core / store / queries.js View on Github external
function upsertMatchPatch(cb) {
        if (match.start_time) {
          return upsert(trx, 'match_patch', {
            match_id: match.match_id,
            patch: constants.patch[utility.getPatchIndex(match.start_time)].name,
          }, {
            match_id: match.match_id,
          }, cb);
        }
        return cb();
      }