chore(core-connections): add driver compare fn

This commit is contained in:
Wroud
2020-09-06 23:49:47 +03:00
parent 716e3e79c5
commit 19e51c3554
@@ -53,6 +53,16 @@ export class DBDriverResource extends CachedMapResource<string, DBDriver> {
return this.data;
}
compare(driverA: DBDriver, driverB: DBDriver): number {
if (driverA.promotedScore === driverB.promotedScore)
{
return (driverA.name || '').localeCompare((driverB.name || ''));
}
return (driverB.promotedScore || 0) - (driverA.promotedScore || 0);
}
protected async loader(key: string): Promise<Map<string, DBDriver>> {
const { driverList } = await this.graphQLService.gql.driverList();