diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2017-04-07 21:34:31 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2017-04-07 21:34:31 +0200 |
| commit | 9932435c28a82164a02f3039b46dd5fb98d5223a (patch) | |
| tree | 2d929da389099fbfef3cac7d823541ba02c04770 | |
| parent | 72165f52411deaf633a7d6c301f0650c94f79671 (diff) | |
| download | compiler-master.tar.gz compiler-master.zip | |
| -rw-r--r-- | worker.js | 23 |
1 files changed, 18 insertions, 5 deletions
@@ -105,11 +105,16 @@ var RABBITMQ_URI = process.env.RABBITMQ_URI || "amqp://localhost", await model.Participant.findOne({ where: { api_id: api_participant.api_id }, include: [ { - model: model.Roster, - include: [ - model.Match - ] - } ] + model: model.Roster, + include: [ + model.Match + ] + }, { + model: model.ItemParticipant, + as: "items", + include: [ model.Item ] + } + ] }) )) })) @@ -166,6 +171,14 @@ var RABBITMQ_URI = process.env.RABBITMQ_URI || "amqp://localhost", if (participant.roster.get("hero_kills") == 0) participant_stats.kill_participation = 0; else participant_stats.kill_participation = participant.get("kills") / participant.roster.get("hero_kills"); + participant_stats.sustain_score = participant.items.reduce((score, item) => { + if (item.get("action") == "final") { + if (["Eve of Harvest", "Serpent Mask"].indexOf(item.item.get("name")) != -1) + return score + 20; + } + return score; + }, 0); + return participant_stats; } })(); |
