From 507abfb534dd74b06a5868eae57d30e49625c2fa Mon Sep 17 00:00:00 2001 From: Gaston Yelmini Date: Thu, 14 Dec 2023 13:12:42 -0300 Subject: [PATCH] INT-9845: add additional logs --- src/gsuite/clients/GSuiteInstalledAppsClient.ts | 10 ++++++---- src/steps/chrome-extensions/index.ts | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/gsuite/clients/GSuiteInstalledAppsClient.ts b/src/gsuite/clients/GSuiteInstalledAppsClient.ts index d7f6c1b..40de3fb 100644 --- a/src/gsuite/clients/GSuiteInstalledAppsClient.ts +++ b/src/gsuite/clients/GSuiteInstalledAppsClient.ts @@ -25,19 +25,21 @@ export class GSuiteInstalledAppsClient extends GSuiteChromeManagementClient { ): Promise { const client = await this.getAuthenticatedServiceClient(); - const threeMonths = new Date(); - threeMonths.setMonth(threeMonths.getMonth() - 3); - const threeMonthsFormatted = threeMonths.toISOString().split('T')[0]; // Format date to YYYY-MM-DD + const oneMonth = new Date(); + oneMonth.setMonth(oneMonth.getMonth() - 1); + const oneMonthFormatted = oneMonth.toISOString().split('T')[0]; // Format date to YYYY-MM-DD await this.iterateApi( async () => { return client.customers.reports.countInstalledApps({ customer: `customers/${this.accountId}`, - filter: `app_type=${appType} AND latest_profile_active_date>=${threeMonthsFormatted}`, + filter: `app_type=${appType} AND latest_profile_active_date>=${oneMonthFormatted} AND total_install_count>0`, pageSize: 1000, }); }, async (data) => { + // TEMP 9845: + this.logger.info(`Installed apps length ${data.installedApps?.length}`); await pMap( data.installedApps || [], async (app) => { diff --git a/src/steps/chrome-extensions/index.ts b/src/steps/chrome-extensions/index.ts index 8f72040..63ead48 100644 --- a/src/steps/chrome-extensions/index.ts +++ b/src/steps/chrome-extensions/index.ts @@ -17,7 +17,7 @@ import { isAuthorizationError } from '../../utils/isAuthorizationError'; const APP_EXTENSION_TYPE = 'EXTENSION'; function isMultipleOfHundredThousand(num: number) { - return num % 100000 === 0; + return num % 1000 === 0; } export async function fetchChromeExtensions({ @@ -42,7 +42,7 @@ export async function fetchChromeExtensions({ } await jobState.addEntity(createChromeExtensionEntity(app)); - processedCount++; + processedCount = processedCount + 1; if (isMultipleOfHundredThousand(processedCount)) { logger.info(`Processing extensions: ${processedCount}`);