Skip to content

Commit

Permalink
nits
Browse files Browse the repository at this point in the history
  • Loading branch information
abrantesarthur committed Jan 24, 2025
1 parent 6bb845f commit 75415dc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/oneTrust/helpers/syncOneTrustAssessmentToDisk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export const syncOneTrustAssessmentToDisk = ({
assessment,
index,
total,
wrap: false,
}),
);
} else {
Expand All @@ -55,7 +56,7 @@ export const syncOneTrustAssessmentToDisk = ({
assessment,
index,
total,
}),
wrap: false, }),
);
}
} else if (fileFormat === OneTrustFileFormat.Csv) {
Expand Down
1 change: 0 additions & 1 deletion src/oneTrust/helpers/syncOneTrustAssessmentToTranscend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export const syncOneTrustAssessmentToTranscend = async ({
assessment,
index,
total,
wrap: true,
});

// transform the csv record into a valid input to the mutation
Expand Down
12 changes: 7 additions & 5 deletions src/oneTrust/helpers/syncOneTrustAssessments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const syncOneTrustAssessments = async ({
logger.info('Getting list of all assessments from OneTrust...');
const assessments = await getListOfOneTrustAssessments({ oneTrust });

// a cache of OneTrust users so we avoid sending requests for users already fetched
// a cache of OneTrust users so we avoid requesting already fetched users
const oneTrustCachedUsers: Record<string, OneTrustGetUserResponse> = {};

// split all assessments in batches, so we can process some of steps in parallel
Expand Down Expand Up @@ -115,7 +115,7 @@ export const syncOneTrustAssessments = async ({

// fetch assessment internal respondents information
const { respondents } = assessmentDetails;
// internal respondents names are not emails.
// if a user is an internal respondents, their 'name' field can't be an email.
const internalRespondents = respondents.filter(
(r) => !r.name.includes('@'),
);
Expand Down Expand Up @@ -179,12 +179,14 @@ export const syncOneTrustAssessments = async ({
await mapSeries(
batchEnrichedAssessments,
async (enrichedAssessment, index) => {
const trueIndex = batch * BATCH_SIZE + index;
// the assessment's global index takes its batch into consideration
const globalIndex = batch * BATCH_SIZE + index;

if (dryRun && file && fileFormat) {
// sync to file
syncOneTrustAssessmentToDisk({
assessment: enrichedAssessment,
index: trueIndex,
index: globalIndex,
total: assessments.length,
file,
fileFormat,
Expand All @@ -195,7 +197,7 @@ export const syncOneTrustAssessments = async ({
assessment: enrichedAssessment,
transcend,
total: assessments.length,
index: trueIndex,
index: globalIndex,
});
}
},
Expand Down

0 comments on commit 75415dc

Please sign in to comment.