Skip to content

Commit

Permalink
Merge pull request #324 from collective-service/fix/crucial-bugs
Browse files Browse the repository at this point in the history
Solved crucial assigned bugs
  • Loading branch information
ranjan-stha authored Nov 10, 2022
2 parents 3c0dfb4 + 2b70178 commit 051b8df
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/components/CustomTooltip/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function CustomTooltip(props: Props) {
<div className={styles.tooltipContent}>
{isDefined(valueLabel) && `${valueLabel} : `}
{(isDefined(value) && value !== null) && formatNumber(
format ?? 'raw',
format === 'million' ? 'raw' : format,
value,
)}
{(isDefined(minValue) && isDefined(maxValue))
Expand Down
2 changes: 1 addition & 1 deletion app/components/UncertaintyChart/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function UncertaintyChart(props: Props) {
heading={data[0].payload?.indicatorName ?? ''}
subHeadingLabel={data[0].payload?.region}
subHeading={`(${data[0].payload?.date})`}
value={data[0].payload?.tooltipValue ?? 0}
value={data[0].payload?.tooltipValue}
minValue={data[0].payload?.minimumValue}
maxValue={data[0].payload?.maximumValue}
/>
Expand Down
47 changes: 43 additions & 4 deletions app/views/Dashboard/Overview/PercentageCardGroup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,28 @@ const OVERVIEW_STATS = gql`
format
emergency
}
outbreakRegion: regionLevel (
filters: {
category: "Global",
emergency: $emergency,
isTwelveMonth: true,
indicatorId: $indicatorId,
region: $region,
}
order: {
indicatorMonth: DESC
}
pagination: {
limit: 12
}
) {
id
indicatorId
indicatorMonth
indicatorValueRegional
format
emergency
}
regionalBreakdownRegion: regionLevel (
filters: {
emergency: $emergency,
Expand Down Expand Up @@ -428,16 +450,33 @@ function PercentageCardGroup(props: Props) {
}).sort((a, b) => compareDate(a.date, b.date))
), [overviewStatsResponse?.uncertaintyRegion]);

const outbreakLineChart = useMemo(() => (
overviewStatsResponse?.outbreak.map((outbreak) => (
const outbreakLineChart = useMemo(() => {
const outbreakGlobal = overviewStatsResponse?.outbreak.map((outbreak) => (
{
id: outbreak.id,
emergency: outbreak.emergency,
contextDate: outbreak.indicatorMonth,
[outbreak.emergency]: outbreak.indicatorValueGlobal,
}
))
), [overviewStatsResponse?.outbreak]);
));

const outbreakRegion = overviewStatsResponse?.outbreakRegion.map((region) => (
{
id: region.id,
emergency: region.emergency,
contextDate: region.indicatorMonth,
[region.emergency]: region.indicatorValueRegional,
}
));
if (filterValues?.region) {
return outbreakRegion;
}
return outbreakGlobal;
}, [
overviewStatsResponse?.outbreak,
overviewStatsResponse?.outbreakRegion,
filterValues?.region,
]);

const renderLegend = useCallback((legendProps: LegendProps) => {
const { payload } = legendProps;
Expand Down

0 comments on commit 051b8df

Please sign in to comment.