diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2017-04-01 12:42:23 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2017-04-01 12:42:23 +0200 |
| commit | bbfc647cff598cda5d82d1baee2b3d97b4b551e1 (patch) | |
| tree | 96428cb94bfce26a7b20c742fa73c84b77d8c1e9 | |
| parent | 392160fdbbb45a93ebc90d57577fb62227de4c5e (diff) | |
| download | compiler-bbfc647cff598cda5d82d1baee2b3d97b4b551e1.tar.gz compiler-bbfc647cff598cda5d82d1baee2b3d97b4b551e1.zip | |
calculate player.last_match_created_date
| -rw-r--r-- | worker.js | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -59,6 +59,27 @@ var RABBITMQ_URI = process.env.RABBITMQ_URI || "amqp://localhost", let player_api_id = player.api_id, player_ext = {}; + // set last_match_created_date + let lmcd = (await model.Participant.findOne({ + where: { + player_api_id: player_api_id + }, + attributes: [ [seq.col("roster.match.created_at"), "last_match_created_date"] ], + include: [ { + model: model.Roster, + attributes: [], + include: [ { + model: model.Match, + attributes: [] + } ] + } ], + order: [ + [seq.col("last_match_created_date"), "DESC"] + ] + })).get("last_match_created_date"); + await model.Player.update({ last_match_created_date: lmcd }, { where: { api_id: player_api_id } }); + + // calculate "extended" player_ext fields like wins per patch player_ext.player_api_id = player_api_id; //player_ext.series = "" |
