@@ -50,7 +50,7 @@ export const syncOneTrustAssessments = async ({
50
50
logger . info ( 'Getting list of all assessments from OneTrust...' ) ;
51
51
const assessments = await getListOfOneTrustAssessments ( { oneTrust } ) ;
52
52
53
- // a cache of OneTrust users so we avoid sending requests for users already fetched
53
+ // a cache of OneTrust users so we avoid requesting already fetched users
54
54
const oneTrustCachedUsers : Record < string , OneTrustGetUserResponse > = { } ;
55
55
56
56
// split all assessments in batches, so we can process some of steps in parallel
@@ -115,7 +115,7 @@ export const syncOneTrustAssessments = async ({
115
115
116
116
// fetch assessment internal respondents information
117
117
const { respondents } = assessmentDetails ;
118
- // internal respondents names are not emails .
118
+ // if a user is an internal respondents, their 'name' field can't be an email .
119
119
const internalRespondents = respondents . filter (
120
120
( r ) => ! r . name . includes ( '@' ) ,
121
121
) ;
@@ -179,12 +179,14 @@ export const syncOneTrustAssessments = async ({
179
179
await mapSeries (
180
180
batchEnrichedAssessments ,
181
181
async ( enrichedAssessment , index ) => {
182
- const trueIndex = batch * BATCH_SIZE + index ;
182
+ // the assessment's global index takes its batch into consideration
183
+ const globalIndex = batch * BATCH_SIZE + index ;
184
+
183
185
if ( dryRun && file && fileFormat ) {
184
186
// sync to file
185
187
syncOneTrustAssessmentToDisk ( {
186
188
assessment : enrichedAssessment ,
187
- index : trueIndex ,
189
+ index : globalIndex ,
188
190
total : assessments . length ,
189
191
file,
190
192
fileFormat,
@@ -195,7 +197,7 @@ export const syncOneTrustAssessments = async ({
195
197
assessment : enrichedAssessment ,
196
198
transcend,
197
199
total : assessments . length ,
198
- index : trueIndex ,
200
+ index : globalIndex ,
199
201
} ) ;
200
202
}
201
203
} ,
0 commit comments