diff --git a/store/queries.mjs b/store/queries.mjs index 07f311fa7..d31aa270e 100644 --- a/store/queries.mjs +++ b/store/queries.mjs @@ -12,7 +12,7 @@ import redis from './redis.mjs'; import { es, INDEX } from './elasticsearch.mjs'; import cassandra from './cassandra.mjs'; import cacheFunctions from './cacheFunctions.mjs'; -import benchmarksUtil from '../util/benchmarksUtil.js'; +import { benchmarks } from '../util/benchmarksUtil.mjs'; import { archiveGet } from './archive.mjs'; const { redisCount, @@ -27,7 +27,6 @@ const { const { computeMatchData } = compute; const columnInfo = {}; const cassandraColumnInfo = {}; -const { benchmarks } = benchmarksUtil; function doCleanRow(err, schema, row, cb) { if (err) { return cb(err); diff --git a/svc/benchmarks.mjs b/svc/benchmarks.mjs index c9e480367..b1ab579ad 100644 --- a/svc/benchmarks.mjs +++ b/svc/benchmarks.mjs @@ -3,36 +3,7 @@ import buildMatch from '../store/buildMatch.mjs'; import utility from '../util/utility.mjs'; import config from '../config.js'; import redis from '../store/redis.mjs'; - -const benchmarks = { - gold_per_min(m, p) { - return p.gold_per_min; - }, - xp_per_min(m, p) { - return p.xp_per_min; - }, - kills_per_min(m, p) { - return (p.kills / m.duration) * 60; - }, - last_hits_per_min(m, p) { - return (p.last_hits / m.duration) * 60; - }, - hero_damage_per_min(m, p) { - return (p.hero_damage / m.duration) * 60; - }, - hero_healing_per_min(m, p) { - return (p.hero_healing / m.duration) * 60; - }, - tower_damage(m, p) { - return p.tower_damage; - }, - // stuns_per_min(m, p) { - // return (p.stuns / m.duration) * 60; - // }, - // lhten(m, p) { - // return p.lh_t && p.lh_t[10]; - // }, -}; +import { benchmarks } from '../util/benchmarksUtil.mjs'; async function doBenchmarks(matchID, cb) { try { diff --git a/util/benchmarksUtil.mjs b/util/benchmarksUtil.mjs new file mode 100644 index 000000000..8bd858816 --- /dev/null +++ b/util/benchmarksUtil.mjs @@ -0,0 +1,29 @@ +export const benchmarks = { + gold_per_min(m, p) { + return p.gold_per_min; + }, + xp_per_min(m, p) { + return p.xp_per_min; + }, + kills_per_min(m, p) { + return (p.kills / m.duration) * 60; + }, + last_hits_per_min(m, p) { + return (p.last_hits / m.duration) * 60; + }, + hero_damage_per_min(m, p) { + return (p.hero_damage / m.duration) * 60; + }, + hero_healing_per_min(m, p) { + return (p.hero_healing / m.duration) * 60; + }, + tower_damage(m, p) { + return p.tower_damage; + }, + // stuns_per_min(m, p) { + // return (p.stuns / m.duration) * 60; + // }, + // lhten(m, p) { + // return p.lh_t && p.lh_t[10]; + // }, +};