Skip to content

Commit 80df042

Browse files
committed
chore: fixed small issues
Signed-off-by: Uroš Marolt <uros@marolt.me>
1 parent f90ffc8 commit 80df042

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

services/apps/data_sink_worker/src/bin/fix-member-attributes.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import isEqual from 'lodash.isequal'
2+
import mergeWith from 'lodash.mergewith'
23

34
import { connQx, updateMember } from '@crowd/data-access-layer'
45
import {
@@ -159,7 +160,7 @@ setImmediate(async () => {
159160
data.attributes = await mas.setAttributesDefaultValues(data.attributes)
160161

161162
let attributes: Record<string, unknown> | undefined
162-
const temp = { ...data.attributes }
163+
const temp = mergeWith({}, oldAttributes, data.attributes)
163164
const manuallyChangedFields: string[] = data.manuallyChangedFields || []
164165

165166
if (manuallyChangedFields.length > 0) {
@@ -212,7 +213,7 @@ setImmediate(async () => {
212213
'Updating member attributes',
213214
)
214215

215-
// await updateMember(pgQx, data.id, { attributes } as any)
216+
await updateMember(pgQx, data.id, { attributes } as any)
216217
batchUpdated++
217218
totalUpdated++
218219
log.debug({ memberId: data.id }, 'Member attributes updated successfully')

0 commit comments

Comments
 (0)