Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Commit 3870d19

Browse files
committed
Fixing groupIds issue
1 parent 664aa1e commit 3870d19

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/scripts/migrations/007-fix-timelineTemplateIds.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ const migrationFunction = {
2323
for (const challenge of challenges) {
2424
try {
2525
challenge.timelineTemplateId = await challengeService.mapTimelineTemplateId(challenge.trackId, challenge.typeId)
26+
challenge.legacy.migration = 7
27+
logger.debug(`Updating ${JSON.stringify(challenge.id)} with timelineTemplateId ${challenge.timelineTemplateId}`)
2628
await challengeService.save(challenge)
2729
} catch (e) {
2830
logger.warn(`Timeline Template Not found for trackId: ${challenge.trackId} typeId: ${challenge.typeId}`)
@@ -45,7 +47,11 @@ async function getChallengesMissingData (page = 0, perPage = 10) {
4547
from: page * perPage,
4648
body: {
4749
query: {
48-
match_all: {}
50+
range: {
51+
'legacy.migration': {
52+
lt: 7
53+
}
54+
}
4955
}
5056
}
5157
}

src/services/challengeService.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,10 @@ async function buildV5Challenge (legacyId, challengeListing, challengeDetails) {
509509
challengeDetails = challengeDetailObj.data
510510
}
511511

512+
if (!challengeListing) {
513+
throw Error(`Challenge Listing Not Found in v4 Index ${JSON.stringify(challengeListing)}`)
514+
}
515+
512516
const allGroups = challengeListing.groupIds
513517

514518
if (!allV5Terms) {

0 commit comments

Comments
 (0)