From bfc4eff397d7f5c844d4f0acb3d3648a71f8ec8d Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Wed, 28 Jul 2021 16:49:43 +0300 Subject: [PATCH 1/2] convert all ids to strings --- src/controllers/syncController.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/controllers/syncController.js b/src/controllers/syncController.js index 6b83ae3..2a04a51 100644 --- a/src/controllers/syncController.js +++ b/src/controllers/syncController.js @@ -1,5 +1,6 @@ const config = require('config') const logger = require('../util/logger') +const _ = require('lodash') // const moment = require('moment') const { slice, union, toString, toNumber, remove } = require('lodash') const challengeSyncStatusService = require('../services/challengeSyncStatusService') @@ -75,11 +76,11 @@ async function queueChallenges (filter) { let queuedCount = 0 // get active challenges from v4 - const { ids: v4IdArray } = await syncService.getV4ChallengeIds(filter) + const { ids: v4IdArray } = _.map((await syncService.getV4ChallengeIds(filter)), id => _.toNumber(id)) // console.log('v4', v4IdArray) // logger.debug(`v4 Array ${v4IdArray}`) // get active challenges from v5 - const { ids: v5IdArray } = await syncService.getV5LegacyChallengeIds(filter) + const { ids: v5IdArray } = _.map((await syncService.getV5LegacyChallengeIds(filter)), id => _.toNumber(id)) // logger.debug(`v5 Array ${v5IdArray}`) // combine arrays, return unique From c1bb7a3f9ed000b76931a4f5fd65f0f143f8afe2 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Wed, 4 Aug 2021 16:00:23 +0300 Subject: [PATCH 2/2] Fix issue with filtering IDs --- src/controllers/syncController.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/controllers/syncController.js b/src/controllers/syncController.js index 2a04a51..735f18b 100644 --- a/src/controllers/syncController.js +++ b/src/controllers/syncController.js @@ -76,11 +76,11 @@ async function queueChallenges (filter) { let queuedCount = 0 // get active challenges from v4 - const { ids: v4IdArray } = _.map((await syncService.getV4ChallengeIds(filter)), id => _.toNumber(id)) + const v4IdArray = _.map((await syncService.getV4ChallengeIds(filter)).ids, id => _.toNumber(id)) // console.log('v4', v4IdArray) // logger.debug(`v4 Array ${v4IdArray}`) // get active challenges from v5 - const { ids: v5IdArray } = _.map((await syncService.getV5LegacyChallengeIds(filter)), id => _.toNumber(id)) + const v5IdArray = _.map((await syncService.getV5LegacyChallengeIds(filter)).ids, id => _.toNumber(id)) // logger.debug(`v5 Array ${v5IdArray}`) // combine arrays, return unique