Skip to content

Commit

Permalink
fixed data import with multiple attribute marked as unique (#3027)
Browse files Browse the repository at this point in the history
* fixed data import with multiple attribute marked as unique

* fixing tests

* cleanup yarn.lock

* restored yarn.lock

* fixing tests

---------

Co-authored-by: Stefano Ricci <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Sep 21, 2023
1 parent f5b4cd9 commit bf1652a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export default class DataImportJob extends DataImportBaseJob {
}
} catch (e) {
const { key, params } = e
const errorKey = key || Validation.messageKeys.dataImport.errorUpdatingValues
const errorKey = key ?? Validation.messageKeys.dataImport.errorUpdatingValues
this._addError(errorKey, params)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,11 @@ const _afterNodesUpdate = async ({ survey, record, nodes }, t) => {

const rootUniqueNodeDefsModified = nodeDefsModified.filter((nodeDef) => {
const nodeDefParent = Survey.getNodeDefParent(nodeDef)(survey)
return NodeDef.isRoot(nodeDefParent) && NodeDefValidations.isUnique(NodeDef.getValidations(nodeDef))
return (
NodeDef.isRoot(nodeDefParent) &&
NodeDef.isSingle(nodeDef) &&
NodeDefValidations.isUnique(NodeDef.getValidations(nodeDef))
)
})
if (rootUniqueNodeDefsModified.length > 0) {
// for each modified node def, validate record uniqueness of records with same record unique nodes
Expand Down

0 comments on commit bf1652a

Please sign in to comment.