Skip to content
Snippets Groups Projects
Commit 12b676a7 authored by Sébastien DA ROCHA's avatar Sébastien DA ROCHA :bicyclist:
Browse files

Merge branch 'redmine-issues/14444' into 'develop'

REDMINE_ISSUE-14444|Signalement non trouvé au clic dans popup

See merge request geocontrib/geocontrib-frontend!461
parents 69727156 34cfaa3c
No related branches found
No related tags found
No related merge requests found
......@@ -633,7 +633,6 @@ export default {
try {
fr.readAsText(this.csvFileToImport);
fr.onloadend = () => {
// Find csv delimiter
const commaDelimited = fr.result.split('\n')[0].includes(',');
const semicolonDelimited = fr.result.split('\n')[0].includes(';');
......@@ -644,19 +643,16 @@ export default {
this.featureTypeImporting = false;
return;
}
// Check if file contains 'lat' and 'long' fields
const headersLine =
fr.result
.split('\n')[0]
.split(delimiter)
.map(el => {
return el.replace('\r', '');
})
.filter(el => {
return el === 'lat' || el === 'lon';
});
const headers = fr.result
.split('\n')[0]
.split(delimiter)
.map(el => {
return el.replace('\r', '');
});
const headersCoord = headers.filter(el => {
return el === 'lat' || el === 'lon';
});
// Look for 2 decimal fields in first line of csv
// corresponding to lon and lat
const sampleLine =
......@@ -667,7 +663,7 @@ export default {
return !isNaN(el) && el.indexOf('.') !== -1;
})
.filter(Boolean);
if (sampleLine.length > 1 && headersLine.length === 2) {
if (sampleLine.length > 1 && headersCoord.length === 2) {
this.csvError = null;
this.csvImport = csvToJson(fr.result, delimiter);
this.featureTypeImporting = false;
......
......@@ -250,12 +250,14 @@ export default {
]),
...mapState('feature-type', [
'feature_types',
'feature_type',
]),
...mapState('feature', [
'currentFeature',
'form',
]),
...mapGetters('feature-type', [
'feature_type',
]),
...mapGetters([
'permissions',
]),
......
......@@ -247,6 +247,7 @@ export default {
'archived_on',
'deletion_on',
'feature_type',
'feature_id',
'display_creator',
'display_last_editor',
'project',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment