From 7b3358ccdd63c7ddd3ca039b9d98bd7d8dcdb328 Mon Sep 17 00:00:00 2001 From: Stefano Ricci <1219739+SteRiccio@users.noreply.github.com> Date: Mon, 4 Nov 2024 12:00:13 +0100 Subject: [PATCH] Survey RDB: fixed creation and modified date update (#3634) Co-authored-by: Stefano Ricci Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- .../record/manager/_recordManager/nodeCreationManager.js | 2 +- .../surveyRdb/repository/dataTableUpdateRepository.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/server/modules/record/manager/_recordManager/nodeCreationManager.js b/server/modules/record/manager/_recordManager/nodeCreationManager.js index 125bd3d708..f0fd12a933 100644 --- a/server/modules/record/manager/_recordManager/nodeCreationManager.js +++ b/server/modules/record/manager/_recordManager/nodeCreationManager.js @@ -34,7 +34,7 @@ export const insertNodesInBulk = async ({ user, surveyId, nodesArray, systemActi const nodeValues = nodesArray.map((node) => [ Node.getUuid(node), Node.getDateCreated(node), - Node.getDateCreated(node), + Node.getDateModified(node), Node.getRecordUuid(node), Node.getParentUuid(node), Node.getNodeDefUuid(node), diff --git a/server/modules/surveyRdb/repository/dataTableUpdateRepository.js b/server/modules/surveyRdb/repository/dataTableUpdateRepository.js index 529c535c55..580aacae21 100644 --- a/server/modules/surveyRdb/repository/dataTableUpdateRepository.js +++ b/server/modules/surveyRdb/repository/dataTableUpdateRepository.js @@ -4,7 +4,6 @@ import * as Record from '@core/record/record' import * as Node from '@core/record/node' import { Schemata, TableDataNodeDef } from '@common/model/db' import { TableDataNodeDefColUtils } from '@common/model/db/tables/dataNodeDef/colUtils' -import * as SchemaRdb from '@common/surveyRdb/schemaRdb' import * as NodeDefTable from '@common/surveyRdb/nodeDefTable' import { RdbUpdateTypes, RdbUpdates } from './RdbUpdates' @@ -48,6 +47,8 @@ const _getValuesByColumnName = ({ survey, record, nodeDef, node, ancestorMultipl const result = { [columnSet.uuid]: Node.getUuid(node), [columnSet.parentUuid]: Node.getUuid(ancestorMultipleEntity), + [columnSet.dateCreated]: Node.getDateCreated(node), + [columnSet.dateModified]: Node.getDateModified(node), } if (NodeDef.isRoot(nodeDef)) { Object.assign(result, { @@ -93,7 +94,7 @@ export const generateRdbUpdates = ({ survey, record, nodes }) => { const ancestorMultipleEntity = _findAncestor({ ancestorDefUuid, node, nodes }) const update = { type, - schema: SchemaRdb.getName(Survey.getId(survey)), + schema: Schemata.getSchemaSurveyRdb(Survey.getId(survey)), table: NodeDefTable.getTableName(nodeDef, ancestorDef), nodeDefUuid: NodeDef.getUuid(nodeDef), nodeDefHierarchyLevel: NodeDef.getMetaHierarchy(nodeDef).length,