diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2017-04-23 10:07:01 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2017-04-23 10:07:01 +0200 |
| commit | 29b2e6bd9e94cf7f61fe9112162439d010e3d44f (patch) | |
| tree | af34035c1dd543b91ca44c4be20752923d7adebc /worker.js | |
| parent | ce6e56317ae20510933e66ddfca7f36b7c5e8f52 (diff) | |
| download | cruncher-29b2e6bd9e94cf7f61fe9112162439d010e3d44f.tar.gz cruncher-29b2e6bd9e94cf7f61fe9112162439d010e3d44f.zip | |
filter by region using a join
Diffstat (limited to 'worker.js')
| -rw-r--r-- | worker.js | 25 |
1 files changed, 14 insertions, 11 deletions
@@ -113,9 +113,6 @@ function* chunks(arr) { // merge custom filters Object.assign(where_aggr, tuple[1].get("filter")); - // region is filter by name not by id - } else if (tuple[0].tableName == "region") { - where_aggr["$participant.shard_id$"] = tuple[1].get("name"); // series and skill_tier are ranged filters } else if (tuple[0].tableName == "series") { // use start < date < end comparison @@ -131,6 +128,7 @@ function* chunks(arr) { // build is a special ranged filter } else if (tuple[0].tableName == "build") { // TODO! + // filtering is done via JOINs } else where_aggr["$participant." + tuple[0].tableName + ".id$"] = tuple[1].id } @@ -261,13 +259,14 @@ function* chunks(arr) { model: model.Participant, as: "participant", attributes: [], - include: [ { - model: model.Roster, - attributes: [], - include: [ { - model: model.Match, - attributes: [] - } ] + include: [ + { + model: model.Roster, + attributes: [], + include: [ { + model: model.Match, + attributes: [] + } ] }, { model: model.Hero, as: "hero", @@ -284,7 +283,11 @@ function* chunks(arr) { model: model.Role, as: "role", attributes: [] - } ] + }, { + model: model.Region, + as: "region", + attributes: [] + } ] } ]; const played = await model.ParticipantStats.count({ |
