Skip to content

Commit

Permalink
fix: department with 0
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementNumericite committed Feb 2, 2024
1 parent 96165c6 commit 7370d9b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 22 deletions.
4 changes: 1 addition & 3 deletions webapp-next/components/filters/Departments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ export const FiltersDepartments = (props: Props) => {
departmentRefs[
department.label as keyof typeof departmentRefs
]
} (${department.label.toString().length > 1 ? '' : `0`}${
department.label
})`
} (${department.label})`
: `Inconnu (${department.label})`}
</Text>
</Checkbox>
Expand Down
4 changes: 2 additions & 2 deletions webapp-next/utils/map/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ export const getMapProps = (
};
} = {};
departments.forEach(d => {
states[departmentsCodes[d.toString()]] = {
name: `${departmentRefs[d.toString()]} (${getPercentage(d)})`,
states[departmentsCodes[d]] = {
name: `${departmentRefs[d]} (${getPercentage(d)})`,
description: getFullDescription(d),
color: getColorFromPercentage(d, 'initial'),
hover_color: getColorFromPercentage(d, 'hover')
Expand Down
34 changes: 17 additions & 17 deletions webapp-next/utils/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ export const viewRefs: { label: string; value: View }[] = [
];

export const departmentRefs: { [key: string]: string } = {
'1': 'Ain',
'2': 'Aisne',
'3': 'Allier',
'4': 'Alpes-de-Haute-Provence',
'5': 'Hautes-Alpes',
'6': 'Alpes-Maritimes',
'7': 'Ardèche',
'8': 'Ardennes',
'9': 'Ariège',
'01': 'Ain',
'02': 'Aisne',
'03': 'Allier',
'04': 'Alpes-de-Haute-Provence',
'05': 'Hautes-Alpes',
'06': 'Alpes-Maritimes',
'07': 'Ardèche',
'08': 'Ardennes',
'09': 'Ariège',
'10': 'Aube',
'11': 'Aude',
'12': 'Aveyron',
Expand Down Expand Up @@ -108,14 +108,14 @@ export const departmentRefs: { [key: string]: string } = {
};

export const departmentsCodes: { [key: string]: string } = {
'1': 'FRA5262', // Ain
'2': 'FRA5263', // Aisne
'3': 'FRA5264', // Allier
'4': 'FRA5265', // Alpes-de-Haute-Provence
'6': 'FRA5266', // Alpes-Maritimes
'7': 'FRA5267', // Ardèche
'8': 'FRA5268', // Ardennes
'9': 'FRA5269', // Ariège
'01': 'FRA5262', // Ain
'02': 'FRA5263', // Aisne
'03': 'FRA5264', // Allier
'04': 'FRA5265', // Alpes-de-Haute-Provence
'06': 'FRA5266', // Alpes-Maritimes
'07': 'FRA5267', // Ardèche
'08': 'FRA5268', // Ardennes
'09': 'FRA5269', // Ariège
'10': 'FRA5270', // Aube
'11': 'FRA5271', // Aude
'12': 'FRA5272', // Aveyron
Expand Down

0 comments on commit 7370d9b

Please sign in to comment.