Skip to content

Commit

Permalink
Correction d'import de config pour ne pas créer deux champs avec un m…
Browse files Browse the repository at this point in the history
…ême identifiant (#7)
  • Loading branch information
rap2hpoutre committed Feb 16, 2024
1 parent 9a79a64 commit b2f66c9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dashboard/src/scenes/data-import-export/ImportConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { MutableRefObject, useRef, useState } from 'react';
import { utils, read, writeFile, WorkBook } from 'xlsx';
import { toast } from 'react-toastify';
import { useRecoilState, useRecoilValue } from 'recoil';
import { v4 as uuidv4 } from 'uuid';
import ButtonCustom from '../../components/ButtonCustom';
import { customFieldsPersonsSelector } from '../../recoil/persons';
import { newCustomField, typeOptions } from '../../utils';
Expand Down Expand Up @@ -446,6 +447,7 @@ function processConfigWorkbook(workbook: WorkBook): WorkbookData {
function mergerFieldWithPrevious(field: Partial<CustomField>, previousField?: CustomField): CustomField {
return {
...(newCustomField() as CustomField),
name: `custom-${new Date().toISOString().split('.').join('-').split(':').join('-')}-${uuidv4()}`,
...field,
...(previousField ? { enabled: previousField.enabled } : {}),
...(previousField ? { required: previousField.required } : {}),
Expand Down

0 comments on commit b2f66c9

Please sign in to comment.