Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mise en production 11/09/2024 #875

Merged
merged 4 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion server/src/repositories/housingRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ function filteredQuery(opts: ListQueryOptions) {
queryBuilder.whereIn('occupancy', filters.occupancies);
}
if (filters.energyConsumption?.length) {
queryBuilder.whereIn('energy_consumption', filters.energyConsumption);
queryBuilder.whereIn('energy_consumption_bdnb', filters.energyConsumption);
}
if (filters.establishmentIds?.length) {
queryBuilder.joinRaw(
Expand Down
21 changes: 20 additions & 1 deletion server/src/repositories/test/housingRepository.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {
formatHousingOwnersApi,
HousingOwners
} from '../housingOwnerRepository';
import { HousingApi, OccupancyKindApi } from '~/models/HousingApi';
import { EnergyConsumptionGradesApi, HousingApi, OccupancyKindApi } from '~/models/HousingApi';
import { formatLocalityApi, Localities } from '../localityRepository';
import { LocalityApi } from '~/models/LocalityApi';
import { BuildingApi } from '~/models/BuildingApi';
Expand Down Expand Up @@ -801,6 +801,25 @@ describe('Housing repository', () => {
.includes(actualHousing.id);
});
});

it('should filter by DPE score', async () => {

const actualAD = await housingRepository.find({
filters: {
energyConsumption: ['A' as EnergyConsumptionGradesApi, 'B' as EnergyConsumptionGradesApi, 'C' as EnergyConsumptionGradesApi, 'D' as EnergyConsumptionGradesApi]
}
});

const actualEFG = await housingRepository.find({
filters: {
energyConsumption: ['E' as EnergyConsumptionGradesApi, 'F' as EnergyConsumptionGradesApi, 'G' as EnergyConsumptionGradesApi]
}
});

expect(actualAD.length).toBeGreaterThan(0);
expect(actualEFG.length).toBeGreaterThan(0);
});

});
});

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
data_file_years,data_source,local_id,geo_code,building_id,plot_id,dgfip_address,dgfip_latitude,dgfip_longitude,location_detail,ban_address,ban_score,ban_latitude,ban_longitude,geolocalisation,housing_kind,condominium,rooms_count,building_year,uncomfortable,cadastral_classification,beneficiary_count,living_area,taxed,vacancy_start_year,mutation_date
lovac-2024,lovac,044676505067,04467,04467Zcyt3UIQuL,04467tsuQsoxx2,110 Passage Du Sommerard,85.9108,108.0664,Nord-est,13 Boulevard des Grands Augustins,0.14,10.6733,6.3927,"25.4899,59.4409",MAISON,co,7,2024,false,2,2,59.8,false,2023,2024-07-09T18:33:16.213Z
lovac-2024,lovac,441250017337,44125,44125doCSTfDb2z,44125G1c4nbNr3,77 Quai de la Chaussée-d'Antin,44.7905,110.1082,Sud-est,848 Voie Royale,0.44,37.3772,106.4647,"6.5125,164.1276",APPART,single,1,2023,true,2,6,50.58,true,2024,2024-01-05T12:33:02.004Z
lovac-2024,lovac,172194210686,17219,17219LzNnsUXHnf,17219U2UG4oykO,691 Quai de Paris,-9.9302,-30.307,Nord-ouest,993 Rue du Faubourg Saint-Honoré,0.64,59.3381,173.3487,"44.2484,-125.8855",APPART,other,5,2024,true,9,4,93.17,false,2023,2024-05-26T01:12:40.875Z
lovac-2024,lovac,2B4763967890,2B476,2B476RPmSPMGiAi,2B476mZf1iP10q,20 Boulevard Dauphine,-0.257,-169.286,Sud-ouest,194 Boulevard d'Assas,0.59,28.4147,-79.6161,"-8.8252,8.0527",APPART,co,1,2024,false,7,3,71.63,true,2024,2023-12-12T04:52:33.170Z
lovac-2024,lovac,2A4094716678,2A409,2A4090iLHiCxIAx,2A409DjIPZ5BVP,942 Passage Monsieur-le-Prince,-36.6869,140.8537,Sud-est,317 Impasse des Saussaies,0.62,64.5315,157.7692,"9.1423,-141.7594",APPART,other,10,2024,true,1,4,93.51,true,2024,2023-10-16T08:06:33.028Z
lovac-2024,lovac,710527250799,71052,71052oYYCapCdSO,71052ui1CTmlZ4,99 Place de la Bûcherie,7.5685,170.5864,Sud-ouest,8 Place du Faubourg Saint-Honoré,1,-8.7222,-122.1318,"-57.2384,-137.4804",APPART,single,2,2024,true,1,3,37.98,true,2024,2024-08-07T00:31:13.651Z
lovac-2024,lovac,300852428222,30085,30085j73jdyzldD,30085ROhNjcgfr,519 Passage de l'Odéon,22.3817,6.6816,Sud-ouest,189 Voie Charlemagne,0.32,49.0567,69.0478,"-69.0242,96.2082",MAISON,co,7,2023,false,5,5,85.93,false,2024,2023-10-01T00:15:06.262Z
Loading