Skip to content

Commit 47d3eef

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

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ setImmediate(async () => {
120120
)
121121

122122
// check if any has default empty but other are full
123-
let process = false
123+
let toProcess = false
124124
for (const attName of Object.keys(data.attributes)) {
125125
const defValue = data.attributes[attName].default
126126

@@ -144,18 +144,18 @@ setImmediate(async () => {
144144
{ memberId: data.id, attName, platform, value },
145145
'Found value for attribute',
146146
)
147-
process = true
147+
toProcess = true
148148
break
149149
}
150150
}
151151

152-
if (process) {
152+
if (toProcess) {
153153
break
154154
}
155155
}
156156
}
157157

158-
if (process) {
158+
if (toProcess) {
159159
const oldAttributes = JSON.parse(JSON.stringify(data.attributes)) // Deep copy
160160
data.attributes = await mas.setAttributesDefaultValues(data.attributes)
161161

@@ -213,7 +213,10 @@ setImmediate(async () => {
213213
'Updating member attributes',
214214
)
215215

216-
await updateMember(pgQx, data.id, { attributes } as any)
216+
if (!process.env.TEST_RUN) {
217+
await updateMember(pgQx, data.id, { attributes } as any)
218+
}
219+
217220
batchUpdated++
218221
totalUpdated++
219222
log.debug({ memberId: data.id }, 'Member attributes updated successfully')

0 commit comments

Comments
 (0)