Be able to sort remote queries by number of results
Previously we would set all remote query results to -1 when someone attempted to sort queries. We would then only sort local queries as those had access to the number of results. Let's include number of results for remote queries in the sorting. Co-authored-by: Shati Patel <shati-patel@github.com>
This commit is contained in:
@@ -205,13 +205,12 @@ export class HistoryTreeDataProvider extends DisposableObject {
|
||||
? h2.initialInfo.start.getTime()
|
||||
: h2.remoteQuery?.executionStartTime;
|
||||
|
||||
// result count for remote queries is not available here.
|
||||
const resultCount1 = h1.t === 'local'
|
||||
? h1.completedQuery?.resultCount ?? -1
|
||||
: -1;
|
||||
: h1.resultCount ?? -1;
|
||||
const resultCount2 = h2.t === 'local'
|
||||
? h2.completedQuery?.resultCount ?? -1
|
||||
: -1;
|
||||
: h2.resultCount ?? -1;
|
||||
|
||||
switch (this.sortOrder) {
|
||||
case SortOrder.NameAsc:
|
||||
|
||||
@@ -456,11 +456,11 @@ describe('query-history', () => {
|
||||
|
||||
describe('getChildren', () => {
|
||||
const history = [
|
||||
item('a', 2, 'remote'),
|
||||
item('a', 2, 'remote', 24),
|
||||
item('b', 10, 'local', 20),
|
||||
item('c', 5, 'local', 30),
|
||||
item('d', 1, 'local', 25),
|
||||
item('e', 6, 'remote'),
|
||||
item('e', 6, 'remote', 5),
|
||||
];
|
||||
let treeDataProvider: HistoryTreeDataProvider;
|
||||
|
||||
@@ -503,7 +503,7 @@ describe('query-history', () => {
|
||||
});
|
||||
|
||||
it('should get children for result count ascending', async () => {
|
||||
const expected = [history[0], history[4], history[1], history[3], history[2]];
|
||||
const expected = [history[4], history[1], history[0], history[3], history[2]];
|
||||
treeDataProvider.sortOrder = SortOrder.CountAsc;
|
||||
|
||||
const children = await treeDataProvider.getChildren();
|
||||
@@ -511,7 +511,7 @@ describe('query-history', () => {
|
||||
});
|
||||
|
||||
it('should get children for result count descending', async () => {
|
||||
const expected = [history[0], history[4], history[1], history[3], history[2]].reverse();
|
||||
const expected = [history[4], history[1], history[0], history[3], history[2]].reverse();
|
||||
treeDataProvider.sortOrder = SortOrder.CountDesc;
|
||||
|
||||
const children = await treeDataProvider.getChildren();
|
||||
@@ -573,6 +573,7 @@ describe('query-history', () => {
|
||||
},
|
||||
repositories: []
|
||||
},
|
||||
resultCount,
|
||||
t
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user