Skip to content

Commit

Permalink
fix filters
Browse files Browse the repository at this point in the history
Signed-off-by: simvalery <[email protected]>

Signed-off-by: simvalery <[email protected]>
  • Loading branch information
simvalery committed Aug 13, 2024
1 parent 7f9a37c commit 8a04c36
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,6 @@ export class FiltersAddonBlock {
await this.getData(user);
}

console.log('value', value);

if (value) {
filter[ref.options.field] = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ export function DataSourceBlock(options: Partial<PolicyBlockDecoratorOptions>) {
_globalFilters.$or = [];
}
const filter1 = {} as any;
filter1[key] = {eq: String(globalFilters[key].$eq)};
filter1[key] = {$eq: String(globalFilters[key].$eq)};
_globalFilters.$or.push(filter1);
const filter2 = {} as any;
filter2[key] = {eq: Number(globalFilters[key].$eq)};
filter2[key] = {$eq: Number(globalFilters[key].$eq)};
_globalFilters.$or.push(filter2);
} else {
_globalFilters[key] = globalFilters[key];
Expand All @@ -175,7 +175,7 @@ export function DataSourceBlock(options: Partial<PolicyBlockDecoratorOptions>) {

// If pagination block is not set
if (!paginationData) {
for (const item of await currentSource.getFromSource(user, globalFilters, false, null)) {
for (const item of await currentSource.getFromSource(user, _globalFilters, false, null)) {
(data as any[]).push(item);
}
continue;
Expand All @@ -200,7 +200,7 @@ export function DataSourceBlock(options: Partial<PolicyBlockDecoratorOptions>) {
skip = Math.max(start - previousCount, 0);
limit = paginationData.itemsPerPage - Math.min((previousCount - start), 0);

const childData = await currentSource.getFromSource(user, globalFilters, false, {
const childData = await currentSource.getFromSource(user, _globalFilters, false, {
offset: skip,
limit: limit - currentPosition
});
Expand Down

0 comments on commit 8a04c36

Please sign in to comment.