Skip to content

Commit 1317dfa

Browse files
Pull out getFromQueryToCompare
1 parent b0cdae7 commit 1317dfa

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

extensions/ql-vscode/src/query-history/query-history-manager.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -592,12 +592,7 @@ export class QueryHistoryManager extends DisposableObject {
592592
);
593593
}
594594

595-
const fromItem =
596-
this.compareWithItem &&
597-
this.isSuccessfulCompletedLocalQueryInfo(this.compareWithItem) &&
598-
multiSelect.includes(this.compareWithItem)
599-
? this.compareWithItem
600-
: singleItem;
595+
const fromItem = this.getFromQueryToCompare(singleItem, multiSelect);
601596

602597
let toItem: CompletedLocalQueryInfo | undefined = undefined;
603598
try {
@@ -1070,6 +1065,21 @@ export class QueryHistoryManager extends DisposableObject {
10701065
}
10711066
}
10721067

1068+
private getFromQueryToCompare(
1069+
singleItem: CompletedLocalQueryInfo,
1070+
multiSelect: CompletedLocalQueryInfo[],
1071+
): CompletedLocalQueryInfo {
1072+
if (
1073+
this.compareWithItem &&
1074+
this.isSuccessfulCompletedLocalQueryInfo(this.compareWithItem) &&
1075+
multiSelect.includes(this.compareWithItem)
1076+
) {
1077+
return this.compareWithItem;
1078+
} else {
1079+
return singleItem;
1080+
}
1081+
}
1082+
10731083
private async findOtherQueryToCompare(
10741084
fromItem: CompletedLocalQueryInfo,
10751085
allItemsSelected: CompletedLocalQueryInfo[],

0 commit comments

Comments
 (0)