diff --git a/src/common/helper.js b/src/common/helper.js index 4f76b9a..17c69b7 100755 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -125,13 +125,13 @@ async function getReviewTypes () { */ async function getReviewTypeId (scorecardName) { const reviewTypes = await getReviewTypes() - logger.info(`Review types: ${JSON.stringify(reviewTypes, null, 5)}`) - logger.info(`Looking for: ${scorecardName}`) for (const reviewType of reviewTypes) { if (reviewType.name === scorecardName) { + logger.info(`Looking for: ${scorecardName}, found: ${JSON.stringify(reviewType, null, 4)}`) return reviewType.id } } + logger.info(`Looking for: ${scorecardName}, found NO MATCH`) return null } diff --git a/src/common/informixHelper.js b/src/common/informixHelper.js index 232c53c..eb34499 100644 --- a/src/common/informixHelper.js +++ b/src/common/informixHelper.js @@ -77,8 +77,8 @@ async function loadOnlineReviewDetails (authUser, submission) { } // Adds the review summation to DynamoDB - logger.info(`Creating review summation: ${JSON.stringify(reviewSummation, null, 4)}`) if (reviewSummation) { + logger.info(`Creating review summation: ${JSON.stringify(reviewSummation, null, 4)}`) await ReviewSummationService.createReviewSummation(authUser, reviewSummation) } } diff --git a/src/services/SubmissionService.js b/src/services/SubmissionService.js index c188b18..c9f7c1e 100755 --- a/src/services/SubmissionService.js +++ b/src/services/SubmissionService.js @@ -222,6 +222,11 @@ downloadSubmission.schema = joi.object({ * @return {Promise} Data fetched from ES */ async function listSubmissions (authUser, query) { + let loadLegacy = false + if (query.loadLegacy) { + loadLegacy = true + delete query.loadLegacy + } if (query.challengeId) { // Submission api now only works with v5 challenge id // If it is a legacy challenge id, get the associated v5 challenge id @@ -266,7 +271,7 @@ async function listSubmissions (authUser, query) { // services. We can't do that here because it would introduce a circular dependency because the // review service calls back to the submission service (this file) // The check for submission.legacyId is for Phoenix submissions - we won't necessarily have the ID for those. - if (!hasReviewInES && submission.id && submission.legacySubmissionId && query.loadLegacy) { + if (!hasReviewInES && submission.id && submission.legacySubmissionId && loadLegacy) { await informixHelper.loadOnlineReviewDetails(authUser, submission) }