From 381498a74d137e1de8cad7194775278d5045e8a4 Mon Sep 17 00:00:00 2001 From: mohaned-mashaly Date: Fri, 28 May 2021 16:30:32 +0200 Subject: [PATCH] refactor if's --- src/Cdo.chpl | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/Cdo.chpl b/src/Cdo.chpl index 60ac1f0..1e97811 100644 --- a/src/Cdo.chpl +++ b/src/Cdo.chpl @@ -482,21 +482,16 @@ module Cdo{ proc __cdo_mapRelation(relationType:string, fieldName:string, localKey:string, remoteKey:string="id", pivotTable:string=""){ - if(this.__cdo_rel_mapping.contains(fieldName)){ - - this.__cdo_rel_mapping[fieldName].localKey = localKey; - this.__cdo_rel_mapping[fieldName].remoteKey = remoteKey; + if(this.__cdo_rel_mapping.contains(fieldName)){ this.__cdo_rel_mapping[fieldName].relType = relationType; - this.__cdo_rel_mapping[fieldName].pivotTable = pivotTable; }else{ - this.__cdo_rel_mapping[fieldName] = new __CDO_ModelRelationInfo(relationType); - this.__cdo_rel_mapping[fieldName].localKey = localKey; - this.__cdo_rel_mapping[fieldName].remoteKey = remoteKey; - this.__cdo_rel_mapping[fieldName].pivotTable = pivotTable; } + this.__cdo_rel_mapping[fieldName].remoteKey = remoteKey; + this.__cdo_rel_mapping[fieldName].pivotTable = pivotTable; + this.__cdo_rel_mapping[fieldName].localKey = localKey; } proc __cdo_hasRelationMap(fieldname:string):bool{