Skip to content

Commit

Permalink
refactor: use Black, Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
jpm-cbna committed May 7, 2024
1 parent 10eb6dc commit 84f918b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,7 @@ def lastObservationsCommuneMaille(connection, obs_limit, insee_code):
GROUP BY l.id_observation, l.cd_ref, l.display_name, m.id_maille, m.geojson_maille
ORDER BY l.display_name
"""
results = connection.execute(
text(sql), inseeCode=insee_code, obsLimit=obs_limit
)
results = connection.execute(text(sql), inseeCode=insee_code, obsLimit=obs_limit)
observations = list()
for r in results:
# taxon = (r.nom_vern + " | " + r.lb_nom) if r.nom_vern else r.lb_nom
Expand Down
38 changes: 23 additions & 15 deletions atlas/static/mapGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -574,30 +574,38 @@ function styleMailleLastObs() {
function generateGeoJsonMailleLastObs(observations) {
var features = [];
observations.forEach((obs) => {
findedFeature = features.find(feat => feat.properties.meshId === obs.id_maille);
findedFeature = features.find(
(feat) => feat.properties.meshId === obs.id_maille
);
if (!findedFeature) {
features.push({
"type": "Feature",
"geometry": obs.geojson_maille,
"properties": {
"meshId": obs.id_maille,
"taxons": [{
"cdRef": obs.cd_ref,
"name": obs.taxon,
}],
}
type: "Feature",
geometry: obs.geojson_maille,
properties: {
meshId: obs.id_maille,
taxons: [
{
cdRef: obs.cd_ref,
name: obs.taxon,
},
],
},
});
} else if (!findedFeature.properties.taxons.find(taxon => taxon.cdRef === obs.cd_ref)) {
} else if (
!findedFeature.properties.taxons.find(
(taxon) => taxon.cdRef === obs.cd_ref
)
) {
findedFeature.properties.taxons.push({
"cdRef": obs.cd_ref,
"name": obs.taxon,
cdRef: obs.cd_ref,
name: obs.taxon,
});
}
});

return {
"type": "FeatureCollection",
"features": features,
type: "FeatureCollection",
features: features,
};
}

Expand Down

0 comments on commit 84f918b

Please sign in to comment.