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

Commit 54dfcb8

Browse files
committed
Updating checking logic
1 parent 3c4f1c1 commit 54dfcb8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/services/ProcessorService.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,19 @@ async function associateChallengeTerms (v5Terms, legacyChallengeId) {
7676
logger.debug(`Legacy Terms ${JSON.stringify(legacyTermsArray)}`)
7777
logger.debug(`Legacy NDA Found ${JSON.stringify(legacyNDA)}`)
7878

79-
if (nda.id && !legacyNDA) {
79+
if (nda && nda.id && !legacyNDA) {
8080
logger.debug('v5 NDA exist, not in legacy. Adding to Legacy.')
8181
const m2mToken = await helper.getM2MToken()
8282
const v5Term = await getV5Terms(nda.id, m2mToken)
8383
return termsService.addTermsToChallenge(legacyChallengeId, v5Term.legacyId, config.LEGACY_SUBMITTER_ROLE_ID)
8484
}
8585

86-
if (!nda && legacyNDA) {
86+
if (!nda && legacyNDA && legacyNDA.id) {
8787
logger.debug('Legacy NDA exist, not in V5. Removing from Legacy.')
8888
return termsService.removeTermsFromChallenge(legacyChallengeId, legacyNDA.id, config.LEGACY_SUBMITTER_ROLE_ID)
8989
}
90+
91+
logger.debug('Associate Challenge Terms - Nothing to Do')
9092
}
9193

9294
/**

0 commit comments

Comments
 (0)