Skip to content

Commit

Permalink
fix bug in syncONeTrustASsessmentToDisk
Browse files Browse the repository at this point in the history
  • Loading branch information
abrantesarthur committed Jan 24, 2025
1 parent 8b9075c commit 0ad390c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/oneTrust/helpers/enrichOneTrustAssessment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const enrichOneTrustAssessment = ({
return {
...risk,
...details,
impactLevel: risk.impactLevel ?? 0,
};
});
return {
Expand Down
33 changes: 24 additions & 9 deletions src/oneTrust/helpers/syncOneTrustAssessmentToDisk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,30 @@ export const syncOneTrustAssessmentToDisk = ({
);

if (fileFormat === OneTrustFileFormat.Json) {
fs.appendFileSync(
file,
oneTrustAssessmentToJson({
assessment,
index,
total,
}),
);
if (index === 0) {
fs.writeFileSync(
file,
oneTrustAssessmentToJson({
assessment,
index,
total,
}),
);
} else {
fs.appendFileSync(
file,
oneTrustAssessmentToJson({
assessment,
index,
total,
}),
);
}
} else if (fileFormat === OneTrustFileFormat.Csv) {
fs.appendFileSync(file, oneTrustAssessmentToCsv({ assessment, index }));
if (index === 0) {
fs.writeFileSync(file, oneTrustAssessmentToCsv({ assessment, index }));
} else {
fs.appendFileSync(file, oneTrustAssessmentToCsv({ assessment, index }));
}
}
};

0 comments on commit 0ad390c

Please sign in to comment.