Skip to content

Commit

Permalink
feat: add the included and excluded data file years option ff-2023
Browse files Browse the repository at this point in the history
  • Loading branch information
Falinor committed Dec 11, 2024
1 parent 2c2d8ca commit 7e89bba
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
10 changes: 10 additions & 0 deletions frontend/src/models/HousingFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,11 @@ export const localityKindsOptions: SelectOption<LocalityKind>[] = [
];

export const dataFileYearsIncludedOptions: SelectOption[] = [
{
value: 'ff-2023',
label: 'Fichiers fonciers 2023',
badgeLabel: 'Fichiers fonciers 2023 inclus'
},
{
value: 'lovac-2019',
label: 'ZLV 2019 (>2 ans)',
Expand Down Expand Up @@ -296,6 +301,11 @@ export const dataFileYearsIncludedOptions: SelectOption[] = [
].sort((optionA, optionB) => optionB.value.localeCompare(optionA.value));

export const dataFileYearsExcludedOptions: SelectOption[] = [
{
value: 'ff-2023',
label: 'Fichiers fonciers 2023',
badgeLabel: 'Fichiers fonciers 2023 exclus'
},
{
value: 'lovac-2019',
label: 'ZLV 2019 (>2 ans)',
Expand Down
16 changes: 12 additions & 4 deletions server/src/test/testFixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,13 +287,21 @@ export const genHousingApi = (
const department = geoCode.substring(0, 2);
const locality = geoCode.substring(2, 5);
const invariant = genInvariant(locality);
const dataYears = faker.helpers
.arrayElements(fp.range(2019, new Date().getUTCFullYear() + 1), {
const dataYears = faker.helpers.arrayElements(
fp.range(2019, new Date().getUTCFullYear() + 1),
{
min: 1,
max: new Date().getUTCFullYear() + 1 - 2019
})
}
);
const dataFileYears = dataYears
.map((year) => `lovac-${year}`)
.concat(
faker.helpers.maybe(() => 'ff-2023', {
probability: 0.2
}) ?? []
)
.toSorted();
const dataFileYears = dataYears.map((year) => `lovac-${year}`);

return {
id,
Expand Down

0 comments on commit 7e89bba

Please sign in to comment.