Skip to content

Commit

Permalink
fix: string departments
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementNumericite committed Jan 29, 2024
1 parent 8da2202 commit d3cb8fb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions webapp-next/utils/map/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ export const getMapProps = (
};

const getCountFromKey = (key: number): number => {
const hit = hits.find(h => h.key === key);
const hit = hits.find(h => h.key === key.toString());
// return hit ? (isNC(hit.doc_count) ? 'NC' : hit.doc_count) : 0;
return hit ? hit.doc_count : 0;
};

const getPercentage = (key: number): string => {
const hit = hits.find(h => h.key === key);
const hit = hits.find(h => h.key === key.toString());
if (!hit || !total) return '0%';
// if (isNC(hit.doc_count)) return 'NC';
return `${Math.round((hit.doc_count / total) * 10000) / 100}%`;
Expand All @@ -76,7 +76,7 @@ export const getMapProps = (
key: number,
kind: 'initial' | 'hover'
): string => {
const hit = hits.find(h => h.key === key);
const hit = hits.find(h => h.key === key.toString());
if (!hit || !total) return stateColors.NEUTRAL[kind];

const percentage = hit.doc_count / total;
Expand All @@ -87,7 +87,7 @@ export const getMapProps = (
};

const getFullDescription = (key: number): string => {
const hit = hits.find(h => h.key === key);
const hit = hits.find(h => h.key === key.toString());
if (!hit) return '';

if (hit.children) {
Expand Down

0 comments on commit d3cb8fb

Please sign in to comment.