From 1c58edde5d03ef3c4bd0a7337f45f4099c3b7c2d Mon Sep 17 00:00:00 2001 From: Adrian Mroz Date: Fri, 23 Oct 2020 14:02:50 +0200 Subject: [PATCH] If dynamicSubsetFormula returns Expression.TRUE, we can bypass applying filter on $main --- src/server/routes/plywood/apply-subset.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/server/routes/plywood/apply-subset.ts b/src/server/routes/plywood/apply-subset.ts index 6cc99612d..a68461036 100644 --- a/src/server/routes/plywood/apply-subset.ts +++ b/src/server/routes/plywood/apply-subset.ts @@ -15,7 +15,7 @@ */ import { IncomingHttpHeaders } from "http"; -import { Expression, RefExpression } from "plywood"; +import { Expression, LiteralExpression, RefExpression } from "plywood"; import { DynamicSubsetFormula } from "../../../common/models/dynamic-subset-formula/dynamic-subset-formula"; import { isNil } from "../../../common/utils/general/general"; @@ -36,6 +36,9 @@ export function applySubset(expression: Expression, dynamicSubsetFormula: Dynami console.log("DynamicSubsetFormula should return Expression, instead returned:", subsetFilter); return expression; } + if (subsetFilter instanceof LiteralExpression && Expression.TRUE.equals(subsetFilter)) { + return expression; + } return filterMain(expression, subsetFilter); } catch (e) { console.log("DynamicSubsetFormula function threw error:", e.message);