Pull out getFromQueryToCompare

This commit is contained in:
Robert
2023-04-25 15:44:53 +01:00
parent b0cdae7c9f
commit 1317dfa581

View File

@@ -592,12 +592,7 @@ export class QueryHistoryManager extends DisposableObject {
); );
} }
const fromItem = const fromItem = this.getFromQueryToCompare(singleItem, multiSelect);
this.compareWithItem &&
this.isSuccessfulCompletedLocalQueryInfo(this.compareWithItem) &&
multiSelect.includes(this.compareWithItem)
? this.compareWithItem
: singleItem;
let toItem: CompletedLocalQueryInfo | undefined = undefined; let toItem: CompletedLocalQueryInfo | undefined = undefined;
try { try {
@@ -1070,6 +1065,21 @@ export class QueryHistoryManager extends DisposableObject {
} }
} }
private getFromQueryToCompare(
singleItem: CompletedLocalQueryInfo,
multiSelect: CompletedLocalQueryInfo[],
): CompletedLocalQueryInfo {
if (
this.compareWithItem &&
this.isSuccessfulCompletedLocalQueryInfo(this.compareWithItem) &&
multiSelect.includes(this.compareWithItem)
) {
return this.compareWithItem;
} else {
return singleItem;
}
}
private async findOtherQueryToCompare( private async findOtherQueryToCompare(
fromItem: CompletedLocalQueryInfo, fromItem: CompletedLocalQueryInfo,
allItemsSelected: CompletedLocalQueryInfo[], allItemsSelected: CompletedLocalQueryInfo[],