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

Commit c45913b

Browse files
ALl meta should be strings
1 parent e0179e9 commit c45913b

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

src/utils/metadataExtractor.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const getMeta = (metadata = [], key) => _.find(metadata, meta => meta.name === k
1616
* @param {Any} defaultValue the default value
1717
*/
1818
function extractBillingProject (challenge, defaultValue) {
19-
return _.get(challenge, 'billingAccountId', _.get(challenge, 'billing.billingAccountId', defaultValue))
19+
return _.get(challenge, 'billingAccountId', _.get(challenge, 'billing.billingAccountId', _.toString(defaultValue)))
2020
}
2121

2222
/**
@@ -26,7 +26,7 @@ function extractBillingProject (challenge, defaultValue) {
2626
*/
2727
function extractSubmissionLimit (challenge, defaultValue) {
2828
const entry = getMeta(challenge.metadata, 'submissionLimit')
29-
if (!entry) return defaultValue
29+
if (!entry) return _.toString(defaultValue)
3030
try {
3131
const parsedEntryValue = JSON.parse(entry.value)
3232
if (parsedEntryValue.limit) {
@@ -37,7 +37,7 @@ function extractSubmissionLimit (challenge, defaultValue) {
3737
} catch (e) {
3838
entry.value = null
3939
}
40-
return entry.value || defaultValue
40+
return _.toString(entry.value || defaultValue)
4141
}
4242

4343
/**
@@ -46,7 +46,7 @@ function extractSubmissionLimit (challenge, defaultValue) {
4646
* @param {Any} defaultValue the default value
4747
*/
4848
function extractSpecReviewCost (challenge, defaultValue) {
49-
return _.get(_.find(_.get(challenge, 'prizeSets', []), p => p.type === 'specReviewer') || {}, 'prizes[0].value', defaultValue)
49+
return _.get(_.find(_.get(challenge, 'prizeSets', []), p => p.type === 'specReviewer') || {}, 'prizes[0].value', _.toString(defaultValue))
5050
}
5151

5252
/**
@@ -56,8 +56,8 @@ function extractSpecReviewCost (challenge, defaultValue) {
5656
*/
5757
function extractDrPoints (challenge, defaultValue) {
5858
const entry = getMeta(challenge.metadata, 'drPoints')
59-
if (!entry) return defaultValue
60-
return entry.value || defaultValue
59+
if (!entry) return _.toString(defaultValue)
60+
return _.toString(entry.value || defaultValue)
6161
}
6262

6363
/**
@@ -67,7 +67,7 @@ function extractDrPoints (challenge, defaultValue) {
6767
*/
6868
function extractApprovalRequired (challenge, defaultValue) {
6969
const entry = getMeta(challenge.metadata, 'approvalRequired')
70-
if (!entry) return defaultValue
70+
if (!entry) return _.toString(defaultValue)
7171
return _.toString(entry.value)
7272
}
7373

@@ -78,7 +78,7 @@ function extractApprovalRequired (challenge, defaultValue) {
7878
*/
7979
function extractPostMortemRequired (challenge, defaultValue) {
8080
const entry = getMeta(challenge.metadata, 'postMortemRequired')
81-
if (!entry) return defaultValue
81+
if (!entry) return _.toString(defaultValue)
8282
return _.toString(entry.value)
8383
}
8484

@@ -89,7 +89,7 @@ function extractPostMortemRequired (challenge, defaultValue) {
8989
*/
9090
function extractTrackLateDeliverablesRequired (challenge, defaultValue) {
9191
const entry = getMeta(challenge.metadata, 'trackLateDeliverables')
92-
if (!entry) return defaultValue
92+
if (!entry) return _.toString(defaultValue)
9393
return _.toString(entry.value)
9494
}
9595

@@ -100,7 +100,7 @@ function extractTrackLateDeliverablesRequired (challenge, defaultValue) {
100100
*/
101101
function extractAllowStockArtRequired (challenge, defaultValue) {
102102
const entry = getMeta(challenge.metadata, 'allowStockArt')
103-
if (!entry) return defaultValue
103+
if (!entry) return _.toString(defaultValue)
104104
return _.toString(entry.value)
105105
}
106106

@@ -111,7 +111,7 @@ function extractAllowStockArtRequired (challenge, defaultValue) {
111111
*/
112112
function extractSubmissionViewable (challenge, defaultValue) {
113113
const entry = getMeta(challenge.metadata, 'submissionViewable')
114-
if (!entry) return defaultValue
114+
if (!entry) return _.toString(defaultValue)
115115
return _.toString(entry.value)
116116
}
117117

@@ -122,7 +122,7 @@ function extractSubmissionViewable (challenge, defaultValue) {
122122
*/
123123
function extractReviewFeedback (challenge, defaultValue) {
124124
const entry = getMeta(challenge.metadata, 'reviewFeedback')
125-
if (!entry) return defaultValue
125+
if (!entry) return _.toString(defaultValue)
126126
return _.toString(entry.value)
127127
}
128128

@@ -133,8 +133,8 @@ function extractReviewFeedback (challenge, defaultValue) {
133133
*/
134134
function extractEnvironment (challenge, defaultValue) {
135135
const entry = getMeta(challenge.metadata, 'environment')
136-
if (!entry) return defaultValue
137-
return entry.value
136+
if (!entry) return _.toString(defaultValue)
137+
return _.toString(entry.value)
138138
}
139139

140140
/**
@@ -144,8 +144,8 @@ function extractEnvironment (challenge, defaultValue) {
144144
*/
145145
function extractCodeRepo (challenge, defaultValue) {
146146
const entry = getMeta(challenge.metadata, 'codeRepo')
147-
if (!entry) return defaultValue
148-
return entry.value
147+
if (!entry) return _.toString(defaultValue)
148+
return _.toString(entry.value)
149149
}
150150

151151
/**
@@ -155,7 +155,7 @@ function extractCodeRepo (challenge, defaultValue) {
155155
*/
156156
function extractEstimateEffortHours (challenge, defaultValue) {
157157
const entry = getMeta(challenge.metadata, 'effortHoursEstimate')
158-
if (!entry) return defaultValue
158+
if (!entry) return _.toString(defaultValue)
159159
return _.toNumber(entry.value)
160160
}
161161

@@ -166,7 +166,7 @@ function extractEstimateEffortHours (challenge, defaultValue) {
166166
*/
167167
function extractEstimateEffortOffshore (challenge, defaultValue) {
168168
const entry = getMeta(challenge.metadata, 'effortHoursOffshore')
169-
if (!entry) return defaultValue
169+
if (!entry) return _.toString(defaultValue)
170170
return _.toNumber(entry.value)
171171
}
172172

@@ -177,7 +177,7 @@ function extractEstimateEffortOffshore (challenge, defaultValue) {
177177
*/
178178
function extractEstimateEffortOnsite (challenge, defaultValue) {
179179
const entry = getMeta(challenge.metadata, 'effortHoursOnshore')
180-
if (!entry) return defaultValue
180+
if (!entry) return _.toString(defaultValue)
181181
return _.toNumber(entry.value)
182182
}
183183

0 commit comments

Comments
 (0)