summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2017-04-07 21:34:31 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2017-04-07 21:34:31 +0200
commit9932435c28a82164a02f3039b46dd5fb98d5223a (patch)
tree2d929da389099fbfef3cac7d823541ba02c04770
parent72165f52411deaf633a7d6c301f0650c94f79671 (diff)
downloadcompiler-master.tar.gz
compiler-master.zip
link items to participantHEADmasterdevelop2.0.0
-rw-r--r--worker.js23
1 files changed, 18 insertions, 5 deletions
diff --git a/worker.js b/worker.js
index 84203ec..0c407eb 100644
--- a/worker.js
+++ b/worker.js
@@ -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;
}
})();