Skip to content

Commit

Permalink
Merge pull request #483 from AgenceBio/fix/correctif_nom_parcelle
Browse files Browse the repository at this point in the history
fix: gère le nom de parcelle vide
  • Loading branch information
GregoireDucharme authored Dec 19, 2024
2 parents 9ff9595 + 7302e0d commit 4fda20b
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,11 @@ onMounted(() => {
});
function getFeatureName(feature, index) {
return `${feature.properties.NOM ?? `Parcelle ${index + 1}`}`;
if (feature.properties.NOM && feature.properties.NOM != "") {
return feature.properties.NOM;
}
return `Parcelle ${index + 1}`;
}
const parcelles = computed(() => {
Expand Down Expand Up @@ -1142,7 +1146,7 @@ function splitPolygon(dividingLine, index) {
};
const newProperties = {
...propertiesToRetain,
NOM: `${propertiesToRetain.NOM ?? `Parcelle ${index + 1}`}.${i + 1}`,
NOM: `${propertiesToRetain.NOM && propertiesToRetain.NOM != "" ? propertiesToRetain.NOM : `Parcelle ${index + 1}`}.${i + 1}`,
};
modifiedFeature.value.push({
type: "Feature",
Expand Down Expand Up @@ -1963,15 +1967,15 @@ function cutBorder() {
geometry: featureWithoutBorder.value.geometry,
properties: {
...propertiesToRetain,
NOM: `${propertiesToRetain.NOM ?? `Parcelle ${splitFeatureIndex.value + 1}`}.1`,
NOM: `${propertiesToRetain.NOM && propertiesToRetain.NOM != "" ? propertiesToRetain.NOM : `Parcelle ${splitFeatureIndex.value + 1}`}.1`,
},
},
{
type: "Feature",
geometry: border.geometry,
properties: {
...propertiesToRetain,
NOM: `${propertiesToRetain.NOM ?? `Parcelle ${splitFeatureIndex.value + 1}`}.2`,
NOM: `${propertiesToRetain.NOM && propertiesToRetain.NOM != "" ? propertiesToRetain.NOM : `Parcelle ${splitFeatureIndex.value + 1}`}.2`,
},
},
],
Expand Down

0 comments on commit 4fda20b

Please sign in to comment.