From f8d24359b9b1f74b830b88d8407118a59b564c1a Mon Sep 17 00:00:00 2001 From: Pranav C Date: Tue, 11 Jan 2022 11:32:53 +0530 Subject: [PATCH] fix: csv import validation rule correction and improvement Signed-off-by: Pranav C #880 --- .../components/importExport/columnMappingModal.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/nc-gui/components/project/spreadsheet/components/importExport/columnMappingModal.vue b/packages/nc-gui/components/project/spreadsheet/components/importExport/columnMappingModal.vue index 84d32dd2bf..77dae900a3 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/importExport/columnMappingModal.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/importExport/columnMappingModal.vue @@ -124,10 +124,15 @@ export default { }, methods: { - validateField(v, row) { - if (!v) { + validateField(_cn, row) { + if (!_cn) { return true } + + const v = this.meta && this.meta.columns.find(c => c._cn === _cn) + + if ((this.mappings || []).filter(v => v.destCn === _cn).length > 1) { return 'Duplicate mapping found, please remove one of the mapping' } + switch (v.uidt) { case UITypes.Number: if (this.parsedCsv && this.parsedCsv.data && this.parsedCsv.data.slice(0, 500)