Skip to content

HOTFIX - minor cleanup to stabilise submissions API #357

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/common/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion src/common/informixHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/services/SubmissionService.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,11 @@ downloadSubmission.schema = joi.object({
* @return {Promise<Object>} 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
Expand Down Expand Up @@ -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)
}

Expand Down