This repository has been archived by the owner on Nov 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature/COR-1857-refactor-order-of-variants (#4967)
* feat(COR-1857): Reversed variants in graph and legend items * feat(COR-1857): Add logic for tooltip * feat(COR-1857): Removed newline * feat(COR-1857): Reorder tooltip * feat(COR-1857): Make mechanism for putting other variants at end more elegant * feat(COR-1857): Remove todo and skeleton code * feat(COR-1857): Add ordering based on rank in tooltip
- Loading branch information
1 parent
4770e6c
commit 608e7f0
Showing
9 changed files
with
80 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
packages/app/src/domain/variants/data-selection/get-variant-orders.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { NlVariants } from '@corona-dashboard/common'; | ||
import { OrderMatch } from '~/domain/variants/data-selection/types'; | ||
import { isDefined } from 'ts-is-present'; | ||
|
||
export const getVariantOrders = (variants: NlVariants): OrderMatch[] => { | ||
if (!isDefined(variants) || !isDefined(variants.values)) { | ||
return []; | ||
} | ||
|
||
const order = variants.values | ||
.sort((a, b) => a.last_value.order - b.last_value.order) | ||
.map((variant) => { | ||
const variantOrder = variant.last_value.order; | ||
return { | ||
variant: variant.variant_code, | ||
order: variantOrder, | ||
}; | ||
}); | ||
|
||
return order; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters