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

Commit 799f059

Browse files
fixes
1 parent a4e8e45 commit 799f059

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/services/ProcessorService.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -692,10 +692,13 @@ async function processUpdate (message) {
692692
// extract metadata from challenge and insert into IFX
693693
for (const metadataKey of _.keys(constants.supportedMetadata)) {
694694
const metaValue = constants.supportedMetadata[metadataKey].method(message.payload, constants.supportedMetadata[metadataKey].defaultValue)
695-
try {
696-
await metadataService.createOrUpdateMetadata(legacyId, metadataKey, metaValue, _.get(message, 'payload.updatedBy') || _.get(message, 'payload.createdBy'))
697-
} catch (e) {
698-
logger.warn(`Failed to set ${constants.supportedMetadata[metadataKey].description} to ${metaValue}`)
695+
if (metaValue !== null) {
696+
try {
697+
logger.info(`Setting ${constants.supportedMetadata[metadataKey].description} to ${metaValue}`)
698+
await metadataService.createOrUpdateMetadata(legacyId, metadataKey, metaValue, _.get(message, 'payload.updatedBy') || _.get(message, 'payload.createdBy'))
699+
} catch (e) {
700+
logger.warn(`Failed to set ${constants.supportedMetadata[metadataKey].description} to ${metaValue}`)
701+
}
699702
}
700703
}
701704
// Thomas - get rid of this and add required info directly via IFX

src/utils/metadataExtractor.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Metadata extractor
33
*/
44
const _ = require('lodash')
5-
const { prizeSetTypes } = require('../constants')
5+
const constants = require('../constants')
66

77
/**
88
* Get metadata entry by key
@@ -53,7 +53,7 @@ function extractSubmissionLimit (challenge, defaultValue) {
5353
* @param {Any} defaultValue the default value
5454
*/
5555
function extractSpecReviewCost (challenge, defaultValue) {
56-
return _.get(_.find(_.get(challenge, 'prizeSets', []), p => p.type === prizeSetTypes.SpecReview) || {}, 'prizes[0].value', defaultValue)
56+
return _.get(_.find(_.get(challenge, 'prizeSets', []), p => p.type === constants.prizeSetTypes.SpecReview) || {}, 'prizes[0].value', defaultValue)
5757
}
5858

5959
/**

0 commit comments

Comments
 (0)