Skip to content

Commit 314d083

Browse files
authored
Merge pull request #357 from topcoder-platform/develop
HOTFIX - minor cleanup to stabilise submissions API
2 parents 43cf94b + 267a91e commit 314d083

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

src/common/helper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,13 @@ async function getReviewTypes () {
125125
*/
126126
async function getReviewTypeId (scorecardName) {
127127
const reviewTypes = await getReviewTypes()
128-
logger.info(`Review types: ${JSON.stringify(reviewTypes, null, 5)}`)
129-
logger.info(`Looking for: ${scorecardName}`)
130128
for (const reviewType of reviewTypes) {
131129
if (reviewType.name === scorecardName) {
130+
logger.info(`Looking for: ${scorecardName}, found: ${JSON.stringify(reviewType, null, 4)}`)
132131
return reviewType.id
133132
}
134133
}
134+
logger.info(`Looking for: ${scorecardName}, found NO MATCH`)
135135
return null
136136
}
137137

src/common/informixHelper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ async function loadOnlineReviewDetails (authUser, submission) {
7777
}
7878

7979
// Adds the review summation to DynamoDB
80-
logger.info(`Creating review summation: ${JSON.stringify(reviewSummation, null, 4)}`)
8180
if (reviewSummation) {
81+
logger.info(`Creating review summation: ${JSON.stringify(reviewSummation, null, 4)}`)
8282
await ReviewSummationService.createReviewSummation(authUser, reviewSummation)
8383
}
8484
}

src/services/SubmissionService.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,11 @@ downloadSubmission.schema = joi.object({
222222
* @return {Promise<Object>} Data fetched from ES
223223
*/
224224
async function listSubmissions (authUser, query) {
225+
let loadLegacy = false
226+
if (query.loadLegacy) {
227+
loadLegacy = true
228+
delete query.loadLegacy
229+
}
225230
if (query.challengeId) {
226231
// Submission api now only works with v5 challenge id
227232
// If it is a legacy challenge id, get the associated v5 challenge id
@@ -266,7 +271,7 @@ async function listSubmissions (authUser, query) {
266271
// services. We can't do that here because it would introduce a circular dependency because the
267272
// review service calls back to the submission service (this file)
268273
// The check for submission.legacyId is for Phoenix submissions - we won't necessarily have the ID for those.
269-
if (!hasReviewInES && submission.id && submission.legacySubmissionId && query.loadLegacy) {
274+
if (!hasReviewInES && submission.id && submission.legacySubmissionId && loadLegacy) {
270275
await informixHelper.loadOnlineReviewDetails(authUser, submission)
271276
}
272277

0 commit comments

Comments
 (0)