@@ -26,30 +26,33 @@ export async function fixDeletedMemberOrgAffilations(
2626 // 1. Find affected memberId and orgId
2727 const affectedMembers = await activity . getMembersWithDeletedOrgAffilations ( BATCH_SIZE , args . date )
2828
29- for ( const { memberId, organizationId } of affectedMembers ) {
30- // 2. Check if they have activity in questDb
31- const activityCount = await activity . getActivities ( memberId , organizationId )
32-
33- // 2.1 If no activities found, we need to get and insert them
34- if ( activityCount === 0 ) {
35- console . log (
36- `No activities found for member ${ memberId } and org ${ organizationId } , creating from postgres!` ,
37- )
38- const activities = await activity . findActivitiesPg ( memberId , organizationId )
39- await activity . createActivities ( activities )
40- }
41-
42- // 3. Calculate affiliation
43- console . log ( `Calculating member affiliations for ${ memberId } ` )
44- await activity . calculateMemberAffiliations ( memberId )
45-
46- // 4. sync member
47- await syncActivity . syncMembersBatch ( [ memberId ] , true )
48-
49- // 5. Add organizationId to redisCache for sync
50- console . log ( `Adding org ${ organizationId } to redisCache for sync` )
51- await activity . addOrgIdToRedisCache ( organizationId )
52- }
29+ // todo: rm this
30+ console . log ( 'affected members length' , affectedMembers . length )
31+
32+ // for (const { memberId, organizationId } of affectedMembers) {
33+ // // 2. Check if they have activity in questDb
34+ // const activityCount = await activity.getActivities(memberId, organizationId)
35+
36+ // // 2.1 If no activities found, we need to get and insert them
37+ // if (activityCount === 0) {
38+ // console.log(
39+ // `No activities found for member ${memberId} and org ${organizationId}, creating from postgres!`,
40+ // )
41+ // const activities = await activity.findActivitiesPg(memberId, organizationId)
42+ // await activity.createActivities(activities)
43+ // }
44+
45+ // // 3. Calculate affiliation
46+ // console.log(`Calculating member affiliations for ${memberId}`)
47+ // await activity.calculateMemberAffiliations(memberId)
48+
49+ // // 4. sync member
50+ // await syncActivity.syncMembersBatch([memberId], true)
51+
52+ // // 5. Add organizationId to redisCache for sync
53+ // console.log(`Adding org ${organizationId} to redisCache for sync`)
54+ // await activity.addOrgIdToRedisCache(organizationId)
55+ // }
5356
5457 if ( args . testRun ) {
5558 console . log ( 'Test run completed!' )
0 commit comments