Skip to content

Commit

Permalink
fix benchmarks import
Browse files Browse the repository at this point in the history
  • Loading branch information
howardchung committed Dec 2, 2023
1 parent 8932488 commit 6eabfa0
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 32 deletions.
3 changes: 1 addition & 2 deletions store/queries.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
Expand Down
31 changes: 1 addition & 30 deletions svc/benchmarks.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
29 changes: 29 additions & 0 deletions util/benchmarksUtil.mjs
Original file line number Diff line number Diff line change
@@ -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];
// },
};

0 comments on commit 6eabfa0

Please sign in to comment.