Skip to content

Commit

Permalink
Save only updated attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
milosdes committed Dec 16, 2024
1 parent be9b885 commit 737784c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ const MCFPersonal = ({
&& personalAttributes?.volume === ""
);
} else {
setDisableSave(
personalAttributes?.person === undefined
|| personalAttributes?.person === ""
|| personalAttributes?.filetype === undefined
|| personalAttributes?.filetype === ""
|| personalAttributes?.trackingid === undefined
|| personalAttributes?.trackingid === ""
|| (!isMinistryCoordinator && comparePersonalAttributes(personalAttributes, curPersonalAttributes))
|| (isMinistryCoordinator && comparePersonalAttributes(personalAttributes, curPersonalAttributes) && compareDivision(currentEditRecord.attributes.divisions[0].divisionid, divisionModalTagValue))
setDisableSave(
personalAttributes?.person === undefined
|| personalAttributes?.person === ""
|| personalAttributes?.filetype === undefined
|| personalAttributes?.filetype === ""
|| personalAttributes?.trackingid === undefined
|| personalAttributes?.trackingid === ""
|| (!isMinistryCoordinator && comparePersonalAttributes(personalAttributes, curPersonalAttributes))
|| (isMinistryCoordinator && comparePersonalAttributes(personalAttributes, curPersonalAttributes) && compareDivision(currentEditRecord.attributes.divisions[0].divisionid, divisionModalTagValue))
);
}
},[personalAttributes, divisionModalTagValue])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1892,8 +1892,7 @@ export const RecordsLog = ({

useEffect(() => {
let selectedRecords = records.filter((record) => record.isselected);
let isBulkEdit = selectedRecords.length > 1;
setIsBulkEdit(isBulkEdit);
setIsBulkEdit(selectedRecords.length > 1);
}, [records])

const isBulkEditDisabled = () => {
Expand Down Expand Up @@ -1944,7 +1943,7 @@ export const RecordsLog = ({
}
}
}
} else if (selectedRecords.length > 1) {
} else if (selectedRecords.length > 1 && !currentEditRecord) {
for (let selectedRecord of selectedRecords) {
updateRecords.push(
{
Expand Down
3 changes: 2 additions & 1 deletion request-management-api/request_api/services/recordservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ def updatepersonalattributes(self, requestid, ministryrequestid, requestdata, us
for record in records:
record['attributes'] = json.loads(record['attributes'])
for attribute in requestdata['newpersonalattributes']:
record['attributes']['personalattributes'][attribute] = requestdata['newpersonalattributes'][attribute]
if (requestdata['newpersonalattributes'][attribute] is not None and len(requestdata['newpersonalattributes'][attribute]) > 0):
record['attributes']['personalattributes'][attribute] = requestdata['newpersonalattributes'][attribute]
# divisions = divisions + [div for div in record['attributes']['divisions'] if div not in divisions]
record.update({'updated_at': datetime.now(), 'updatedby': userid})
record['version'] += 1
Expand Down

0 comments on commit 737784c

Please sign in to comment.