Skip to content

Commit

Permalink
editability changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rushtong committed Nov 7, 2023
1 parent d7cd4e7 commit 773a044
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/pages/StudyUpdateForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,18 +151,29 @@ export const StudyUpdateForm = (props) => {
const formatForRegistration = (formData) => {

for (const key of Object.keys(formData)) {
const illegalStudyFields = [formData.studyName, formData.dataSubmitterEmail, formData.dataSubmitterName];
const illegalStudyFields = ['studyName', 'dataSubmitterEmail', 'dataSubmitterName', 'dataSubmitterUserId'];
if (isNil(formData[key]) && illegalStudyFields.includes(formData[key])) {
formData[key] = undefined;
}
}

formData?.consentGroups?.forEach((cg) => {
const validCgFields = [cg.dataLocation, cg.url, cg.fileTypes, cg.numberOfParticipants, cg.dataAccessCommitteeId];
// In the case of missing/required fields, we need to be able to populate them on save
// TODO: This doesn't work as expected
if (isNil(cg.consentGroupName) || cg?.consentGroupName.length === 0) {
validCgFields.push(cg.consentGroupName);
}
if (isNil(cg.accessManagement)) {
validCgFields.push(cg.accessManagement);
}
if (isNil(cg.dataAccessCommitteeId) && cg?.accessManagement === 'controlled') {
validCgFields.push(cg.dataAccessCommitteeId);
}

if(!isNil(cg.datasetId)){
if (!isNil(cg.datasetId)) {
for (const key of Object.keys(cg)) {
if(cg[key]!==cg.datasetId && !validCgFields.includes(cg[key])){
if (cg[key] !== cg.datasetId && !validCgFields.includes(cg[key])) {
cg[key] = undefined;
}
}
Expand Down

0 comments on commit 773a044

Please sign in to comment.