Skip to content

Commit 15b3197

Browse files
committed
fix issue with comment duplication and format
1 parent 320ec52 commit 15b3197

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

ado-importer.js

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -493,12 +493,21 @@ function formatMitigation(annotation){
493493
mitigation += "<b>Action:</b> " + action + "<br>";;
494494

495495
if(!mitigationStatus.includes(action)){
496-
mitigation += "<b>Technique:</b> " + technique + "<br/>";
497-
mitigation += "<b>Specifics:</b> " + specifics + "<br>";
498-
mitigation += "<b>Remaining Risk:</b> " + remaining_risk + "<br>";
499-
mitigation += "<b>Verification:</b> " + verification + "<br>";
496+
// Check if TSRV fields contain meaningful data (not all "Unknown")
497+
const hasTSRVData = technique !== 'Unknown' || specifics !== 'Unknown' || remaining_risk !== 'Unknown' || verification !== 'Unknown';
498+
499+
if (hasTSRVData) {
500+
// Use TSRV format when we have meaningful data
501+
mitigation += "<b>Technique:</b> " + technique + "<br/>";
502+
mitigation += "<b>Specifics:</b> " + specifics + "<br>";
503+
mitigation += "<b>Remaining Risk:</b> " + remaining_risk + "<br>";
504+
mitigation += "<b>Verification:</b> " + verification + "<br>";
505+
} else {
506+
// Fall back to comment format when TSRV data is not available
507+
mitigation += "<b>Comment:</b> " + comment + "<br>";
508+
}
500509
} else {
501-
mitigation += "<b>Comment:</b>" + comment;
510+
mitigation += "<b>Comment:</b> " + comment + "<br>";
502511
}
503512

504513
return { mitigation_title, mitigation }
@@ -547,7 +556,9 @@ async function updateWorkItem(adoClient, adoOrg, adoProject, workItemId, annotat
547556
const { mitigation_title, mitigation } = formatMitigation(annot);
548557

549558
// Check if this mitigation already exists in Discussion
550-
const duplicate_mitigation = existingDiscussion.includes(mitigation_title);
559+
// For Bug work items, check for the full mitigation content, not just the title
560+
// This handles cases where the same mitigation might be added multiple times
561+
const duplicate_mitigation = existingDiscussion.includes(mitigation);
551562

552563
if (!duplicate_mitigation) {
553564
// Add this specific mitigation to Discussion

0 commit comments

Comments
 (0)