Browse Source

fix: skip duplicate options for at import

pull/7391/head
mertmit 10 months ago
parent
commit
8c798de887
  1. 11
      packages/nocodb/src/modules/jobs/jobs/at-import/at-import.processor.ts

11
packages/nocodb/src/modules/jobs/jobs/at-import/at-import.processor.ts

@ -435,19 +435,14 @@ export class AtImportProcessor {
if ((value as any).name === '') { if ((value as any).name === '') {
(value as any).name = 'nc_empty'; (value as any).name = 'nc_empty';
} }
// enumerate duplicates (we don't allow them) // skip duplicates (we don't allow them)
// TODO fix record mapping (this causes every record to map first option, if (
// we can't handle them using data api as they don't provide option id
// within data we might instead get the correct mapping from schema file )
let dupNo = 1;
const defaultName = (value as any).name;
while (
options.find( options.find(
(el) => (el) =>
el.title.toLowerCase() === (value as any).name.toLowerCase(), el.title.toLowerCase() === (value as any).name.toLowerCase(),
) )
) { ) {
(value as any).name = `${defaultName}_${dupNo++}`; continue;
} }
options.push({ options.push({
order: order++, order: order++,

Loading…
Cancel
Save