Skip to content

Commit

Permalink
Merge pull request #1093 from MTES-MCT/remove-contact
Browse files Browse the repository at this point in the history
feat: remove filter 'Prise de contact'
  • Loading branch information
loicguillois authored Jan 23, 2025
2 parents 06ea36f + aa7bffd commit 622f877
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,6 @@ function HousingDetailsCardMobilisation({ housing, campaigns }: Props) {
<LabelNext component="h3">Dernière mise à jour</LabelNext>
<Typography>{lastUpdate(housing)}</Typography>
</Grid>
<Grid xs={6}>
<LabelNext component="h3">Prise de contact</LabelNext>
<Typography>
{campaigns.length === 0
? 'Jamais contacté'
: `Contacté ${campaigns.length} fois`}
</Typography>
</Grid>
<Grid xs={6}>
<LabelNext component="h3">
Dispositifs ({housing.precisions?.length ?? 0})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
beneficiaryCountOptions,
buildingPeriodOptions,
cadastralClassificationOptions,
campaignsCountOptions,
dataFileYearsExcludedOptions,
dataFileYearsIncludedOptions,
energyConsumptionOptions,
Expand Down Expand Up @@ -200,12 +199,6 @@ function HousingFiltersBadges(props: HousingFiltersBadgesProps) {
onChange={(values) => onChange?.({ geoPerimetersExcluded: values })}
/>
)}
<FilterBadges
options={campaignsCountOptions}
values={filters.campaignsCounts}
small={small}
onChange={(values) => onChange?.({ campaignsCounts: values })}
/>
<FilterBadges
options={statusOptions()}
values={filters.statusList?.map(String)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
beneficiaryCountOptions,
buildingPeriodOptions,
cadastralClassificationOptions,
campaignsCountOptions,
dataFileYearsExcludedOptions,
dataFileYearsIncludedOptions,
energyConsumptionOptions,
Expand Down Expand Up @@ -242,17 +241,6 @@ function HousingListFiltersSidemenu(props: Props) {
/>
</Grid>
)}
<Grid component="article" mb={2} xs={12}>
<AppMultiSelect
label="Prise de contact"
options={campaignsCountOptions}
initialValues={filters.campaignsCounts}
onChange={(values) => {
onChangeFilters({ campaignsCounts: values }, 'Prise de contact');
posthog.capture('filtre-prise-de-contact');
}}
/>
</Grid>
</Accordion>
<Accordion
label={
Expand Down
8 changes: 0 additions & 8 deletions frontend/src/models/HousingFilters.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
BeneficiaryCount,
BuildingPeriod,
CampaignCount,
ENERGY_CONSUMPTION_VALUES,
EnergyConsumption,
HousingByBuilding,
Expand Down Expand Up @@ -72,13 +71,6 @@ export const ownerKindOptions: SelectOption<OwnerKind>[] =
label: OWNER_KIND_LABELS[value]
}));

export const campaignsCountOptions: SelectOption<CampaignCount>[] = [
{ value: '0', label: 'Dans aucune campagne en cours' },
{ value: '1', label: 'Déjà contacté 1 fois' },
{ value: '2', label: 'Déjà contacté 2 fois' },
{ value: 'gt2', label: 'Déjà contacté 3 fois et plus' }
];

export const statusOptions = (
statusExcluded?: HousingStatus[]
): SelectOption[] => [
Expand Down
1 change: 0 additions & 1 deletion server/src/models/HousingFiltersApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ const validators = (property = 'filters'): ValidationChain[] => [
body(`${property}.ownershipKinds`).custom(isArrayOf(isString)).optional(),
body(`${property}.housingCounts`).custom(isArrayOf(isString)).optional(),
body(`${property}.vacancyRates`).custom(isArrayOf(isString)).optional(),
body(`${property}.campaignsCounts`).custom(isArrayOf(isString)).optional(),
body(`${property}.campaignIds`).custom(isArrayOf(isUUID)).optional(),
body(`${property}.ownerIds`).custom(isArrayOf(isUUID)).optional(),
body(`${property}.localities`).custom(isArrayOf(isString)).optional(),
Expand Down
24 changes: 0 additions & 24 deletions server/src/repositories/housingRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,32 +455,8 @@ function filteredQuery(opts: FilteredQueryOptions) {
`cardinality(${campaignsTable}.campaign_ids) = 0`
);
}
if (filters.campaignsCounts?.includes('current')) {
whereBuilder.orWhereRaw(
`cardinality(${campaignsTable}.campaign_ids) >= 1`
);
}
if (filters.campaignsCounts?.indexOf('1') !== -1) {
whereBuilder.orWhereRaw(
`cardinality(${campaignsTable}.campaign_ids)`,
1
);
}
if (filters.campaignsCounts?.indexOf('2') !== -1) {
whereBuilder.orWhereRaw(
`cardinality(${campaignsTable}.campaign_ids)`,
2
);
}
if (filters.campaignsCounts?.indexOf('gt3') !== -1) {
whereBuilder.orWhereRaw(
`cardinality(${campaignsTable}.campaign_ids) >= ?`,
3
);
}
});
}

if (filters.ownerIds?.length) {
queryBuilder.whereIn(`${ownerTable}.id`, filters.ownerIds);
}
Expand Down

0 comments on commit 622f877

Please sign in to comment.