Skip to content

Commit 0032f95

Browse files
Fried Hoebenfhoeben
authored andcommitted
Per May 30th 2025 only the first page gets the total count
1 parent 56e05f8 commit 0032f95

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lansweeper/aws/integration-lambda/lansweeper_client.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class LansweeperClient {
132132
return [firstPage];
133133
}
134134

135-
let total = firstPage.total;
135+
const total = firstPage.total;
136136
if (firstPage.items) {
137137
retrieved += firstPage.items.length;
138138
console.log(`retrieved first ${retrieved} of ${total}`);
@@ -149,7 +149,6 @@ class LansweeperClient {
149149
break;
150150
}
151151

152-
total = nextPage.total;
153152
if (nextPage.items && nextPage.items.length > 0) {
154153
retrieved += nextPage.items.length;
155154
console.log(`retrieved first ${retrieved} of ${total}`);
@@ -208,10 +207,11 @@ class LansweeperClient {
208207
.split(' ')
209208
.forEach(field => fields.push(`processors.${field}`));
210209

210+
const totalField = pagination.page === 'FIRST' ? 'total' : '';
211211
const query = `query getAssetResources($siteId: ID!, $pagination: AssetsPaginationInputValidated, $fields: [String!]!) {
212212
site(id: $siteId) {
213213
assetResources(assetPagination: $pagination, fields: $fields, filters: ${filters}) {
214-
total
214+
${totalField}
215215
pagination {
216216
next
217217
}

0 commit comments

Comments
 (0)