Skip to content

Commit

Permalink
Fix bug loopbackio#1795 Count issues related models
Browse files Browse the repository at this point in the history
  • Loading branch information
regevbr committed Nov 30, 2019
1 parent 418d09e commit efb6d43
Showing 1 changed file with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions lib/scope.js
Original file line number Diff line number Diff line change
Expand Up @@ -421,11 +421,7 @@ function defineScope(cls, targetClass, name, params, methods, options) {
// run another query to apply filter on relatedModel(targetModel)
// see github.com/strongloop/loopback-datasource-juggler/issues/1795
let scopeOnRelatedModel = false;
let queryRelated;
let keyFrom;
let relatedModel;
let IdKey;
let fieldsRelated;
let queryRelated, keyFrom, relatedModel, IdKey, fieldsRelated;
if (this._scope && this._scope.collect &&
where !== null && typeof where === 'object') {
queryRelated = {
Expand Down Expand Up @@ -480,11 +476,7 @@ function defineScope(cls, targetClass, name, params, methods, options) {
// run another query to apply filter on relatedModel(targetModel)
// see github.com/strongloop/loopback-datasource-juggler/issues/1795
let scopeOnRelatedModel = false;
let queryRelated;
let keyFrom;
let relatedModel;
let IdKey;
let fieldsRelated;
let queryRelated, keyFrom, relatedModel, IdKey, fieldsRelated;
if (this._scope && this._scope.collect &&
where !== null && typeof where === 'object') {
queryRelated = {
Expand Down Expand Up @@ -567,10 +559,7 @@ function defineScope(cls, targetClass, name, params, methods, options) {
// run another query to apply filter on relatedModel(targetModel)
// see github.com/strongloop/loopback-datasource-juggler/issues/1795
let scopeOnRelatedModel = false;
let queryRelated;
let keyFrom;
let relatedModel;
let IdKey;
let queryRelated, keyFrom, relatedModel, IdKey;
if (this._scope && this._scope.collect &&
filter && filter.where !== null && typeof filter.where === 'object') {
queryRelated = {
Expand Down Expand Up @@ -624,11 +613,7 @@ function defineScope(cls, targetClass, name, params, methods, options) {
// run another query to apply filter on relatedModel(targetModel)
// see github.com/strongloop/loopback-datasource-juggler/issues/1795
let scopeOnRelatedModel = false;
let queryRelated;
let keyFrom;
let relatedModel;
let IdKey;
let fieldsRelated;
let queryRelated, keyFrom, relatedModel, IdKey, fieldsRelated;
if (this._scope && this._scope.collect &&
where !== null && typeof where === 'object') {
queryRelated = {
Expand Down

0 comments on commit efb6d43

Please sign in to comment.