Skip to content

Commit

Permalink
add api
Browse files Browse the repository at this point in the history
  • Loading branch information
howardchung committed Jun 18, 2016
1 parent 9b3f358 commit 63207e4
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
8 changes: 4 additions & 4 deletions java_parser/src/main/java/yasp/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ private class Entry {
public Integer gold_reason;
public Integer xp_reason;
public String valuename;
public Float stun_duration;
public Float slow_duration;
//public Float stun_duration;
//public Float slow_duration;
//entity fields
public Integer gold;
public Integer lh;
Expand Down Expand Up @@ -234,8 +234,8 @@ public void onCombatLogEntry(Context ctx, CombatLogEntry cle) {
combatLogEntry.attackerillusion = cle.isAttackerIllusion();
combatLogEntry.targetillusion = cle.isTargetIllusion();
combatLogEntry.value = cle.getValue();
combatLogEntry.stun_duration = cle.getStunDuration();
combatLogEntry.slow_duration = cle.getSlowDuration();
//combatLogEntry.stun_duration = cle.getStunDuration();
//combatLogEntry.slow_duration = cle.getSlowDuration();
//value may be out of bounds in string table, we can only get valuename if a purchase (type 11)
if (cle.getType() == DOTA_COMBATLOG_TYPES.DOTA_COMBATLOG_PURCHASE) {
combatLogEntry.valuename = cle.getValueName();
Expand Down
11 changes: 11 additions & 0 deletions routes/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,17 @@ module.exports = function(db, redis, cassandra)
});
});
*/
api.get('/match_logs/:match_id', function(req, res, cb)
{
db.raw(`SELECT * FROM match_logs WHERE match_id = ?`, [req.params.match_id]).asCallback(function(err, result)
{
if (err)
{
return cb(err);
}
res.json(result.rows);
});
});
api.get('/distributions', function(req, res, cb)
{
queries.getDistributions(redis, function(err, result)
Expand Down
2 changes: 0 additions & 2 deletions sql/create_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,6 @@ CREATE TABLE match_logs (
gold_reason int,
xp_reason int,
valuename varchar(100),
stun_duration real,
slow_duration real,
gold int,
lh int,
xp int,
Expand Down
6 changes: 5 additions & 1 deletion store/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ function insertMatch(db, redis, match, options, cb)

function upsertMatch(cb)
{
if (!config.ENABLE_POSTGRES_MATCH_STORE_WRITE)
if (!config.ENABLE_POSTGRES_MATCH_STORE_WRITE && !match.leagueid)
{
return cb();
}
Expand All @@ -232,6 +232,10 @@ function insertMatch(db, redis, match, options, cb)
player_slot: pm.player_slot
}, cb);
}, exit);
//TODO create table for picks/bans
//TODO insert picks/bans
//TODO remove dota_unknown to save space
//TODO figure out whehter to store expanded or raw data

function exit(err)
{
Expand Down

0 comments on commit 63207e4

Please sign in to comment.