Skip to content

Commit

Permalink
fix: pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
dlenroc authored Apr 8, 2022
1 parent 6b6673a commit 6ef27a8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"node-fetch": "^2.6.4"
},
"devDependencies": {
"@faker-js/faker": "^6.0.0-alpha.7",
"@faker-js/faker": "^6.1.2",
"@types/chai": "^4.3.0",
"@types/chai-as-promised": "^7.1.5",
"@types/deasync": "^0.1.2",
Expand All @@ -43,15 +43,15 @@
"@types/node": "*",
"chai": "^4.3.6",
"chai-as-promised": "^7.1.1",
"deasync": "^0.1.24",
"deasync": "^0.1.26",
"glob": "^7.2.0",
"intermock": "^0.2.5",
"mocha": "^9.2.1",
"mocha": "^9.2.2",
"nock": "^13.2.4",
"rollup": "^2.69.1",
"rollup": "^2.70.1",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.31.2",
"ts-node": "^10.6.0",
"typescript": "^4.6.2"
"ts-node": "^10.7.0",
"typescript": "^4.6.3"
}
}
4 changes: 1 addition & 3 deletions src/TestRail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -601,9 +601,7 @@ async function pagination<T>(key: string, filters: any, callback: (filters: any)
offset = page++ * limit;

let items = await pagination<T>(key, { ...filters, limit, offset }, callback);
items = items.filter((item: any) => (ids.has(item.id) ? false : ids.add(item.id)));

results.push(...items);
results.push(...items.filter((item: any) => (ids.has(item.id) ? false : ids.add(item.id))));

if (items.length != limit) {
break;
Expand Down

0 comments on commit 6ef27a8

Please sign in to comment.