Skip to content

Commit

Permalink
Remove Form level details that leads to make duplicate confirmation IDS
Browse files Browse the repository at this point in the history
  • Loading branch information
ptugger committed Aug 26, 2023
1 parent d7c45d0 commit 18f400d
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion app/frontend/src/components/designer/FormViewerMultiUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ export default {
try {
let reader = new FileReader();
reader.onload = (e) => {
this.Json = JSON.parse(e.target.result);
this.Json = this.popFormLevelInfo(JSON.parse(e.target.result));
};
reader.onloadend = this.preValidateSubmission;
reader.readAsText(this.file);
Expand All @@ -294,6 +294,24 @@ export default {
});
}
},
popFormLevelInfo(jsonPayload = []) {
/** This function is purely made to remove un-necessery information
* from the json payload. It will also help to remove crucial data
* to be removed from the payload that should not be going to DB.
* Example: Sometime end user use the export json file as a bulk
* upload payload that contains formId, confirmationId and User
* details as well so we need to remove those details from the payload.
*
* This will remove the form object from the payload.
*/
if (jsonPayload.length) {
jsonPayload.forEach(function (submission) {
delete submission.form;
});
}
return jsonPayload;
},
async preValidateSubmission() {
try {
if (!Array.isArray(this.Json)) {
Expand Down

0 comments on commit 18f400d

Please sign in to comment.