Removing stringify and replacing with constructed string. (#23403)

* Removing stringify and replacing with constructed string.

* Addressing PR comments.
This commit is contained in:
kavitham10
2023-06-16 14:33:20 -07:00
committed by GitHub
parent b9dd591c2c
commit 9419fe039c
2 changed files with 15 additions and 2 deletions

View File

@@ -76,6 +76,7 @@ export class LoginMigrationModel {
private _currentStepIdx: number = 0;
private _logins: Map<string, Login>;
private _loginMigrationSteps: LoginMigrationStep[] = [];
public errorCountList: string[] = [];
constructor() {
this.resultsPerStep = new Map<contracts.LoginMigrationStep, contracts.StartLoginMigrationResult>();
@@ -179,7 +180,19 @@ export class LoginMigrationModel {
}
}
this.errorCountMap.set(LoginMigrationStep[step], errorBuckets);
// Making a string of the map elements of errorBuckets
const errorBucketsString = JSON.stringify(
Array.from(errorBuckets.entries()).reduce((o: any, [key, value]) => {
o[key] = value;
return o;
}, {})
);
// Retaining this step in case a revert is needed, but we will be using errorCountList for telemetry
this.errorCountMap.set(LoginMigrationStep[step], errorBucketsString);
// Creating an array of the error codes and its counts for each step
this.errorCountList.push(`[${LoginMigrationStep[step]}: ${errorBucketsString}]`);
}
private setDurationPerStep(step: LoginMigrationStep, result: contracts.StartLoginMigrationResult) {