Skip to content

Commit

Permalink
Ajout données API ✨
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentlaine committed Oct 3, 2024
1 parent b62659b commit a8b72f6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/data/data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export class DataService {
&& (dateDebut ? moment(d.date, 'YYYY-MM-DD').isSameOrAfter(moment(dateDebut, 'YYYY-MM-DD'), 'day') : true)
&& (dateFin ? moment(d.date, 'YYYY-MM-DD').isSameOrBefore(moment(dateFin, 'YYYY-MM-DD'), 'day') : true),
);
dataDepartementFiltered = structuredClone(dataDepartementFiltered);
let departementsToFilter = [];
if (bassinVersant) {
const b = this.bassinsVersants.find(b => b.id === +bassinVersant);
Expand Down Expand Up @@ -387,6 +388,9 @@ export class DataService {
tmp.departements.push({
code: departement.code,
niveauGravite: this.findMaxNiveauGravite(d.departements, departement.code),
niveauGraviteSup: this.findMaxNiveauGravite(d.departements, departement.code, 'SUP'),
niveauGraviteSou: this.findMaxNiveauGravite(d.departements, departement.code, 'SOU'),
niveauGraviteAep: this.findMaxNiveauGravite(d.departements, departement.code, 'AEP'),
});
});
this.dataDepartement.push(tmp);
Expand All @@ -409,12 +413,15 @@ export class DataService {
}
}

findMaxNiveauGravite(restrictions: any[], departementCode: string) {
findMaxNiveauGravite(restrictions: any[], departementCode: string, zoneType?: string) {
const restrictionsDepartement = restrictions.find(r => r.departement === departementCode);
if (!restrictionsDepartement) {
return null;
}
const zonesType = ['SUP', 'SOU', 'AEP'];
let zonesType = ['SUP', 'SOU', 'AEP'];
if (zoneType) {
zonesType = zonesType.filter(z => z === zoneType);
}
const niveauxGravite = ['crise', 'alerte_renforcee', 'alerte', 'vigilance'];
for (const niveauGravite of niveauxGravite) {
for (const zoneType of zonesType) {
Expand Down

0 comments on commit a8b72f6

Please sign in to comment.