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 =
this.compareWithItem &&
this.isSuccessfulCompletedLocalQueryInfo(this.compareWithItem) &&
multiSelect.includes(this.compareWithItem)
? this.compareWithItem
: singleItem;
const fromItem = this.getFromQueryToCompare(singleItem, multiSelect);
let toItem: CompletedLocalQueryInfo | undefined = undefined;
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(
fromItem: CompletedLocalQueryInfo,
allItemsSelected: CompletedLocalQueryInfo[],