Skip to content

Commit 09e8ce8

Browse files
committed
Issues-663: add self-service description
1 parent b2088c8 commit 09e8ce8

File tree

2 files changed

+24
-18
lines changed

2 files changed

+24
-18
lines changed

config/template.json

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@
1515
"group": {
1616
"name": "${ challenge.name }",
1717
"description": "Welcome to [${ challenge.name }](<%- challenge.url %>) Forum.",
18+
"selfServiceDescription": "Welcome to ${ challenge.name } Forum.",
1819
"privacy": "secret",
1920
"type": "challenge"
2021
},
2122
"categories": [
2223
{
2324
"name": "Code Documents",
24-
"selfservice": false,
25+
"selfService": false,
2526
"urlcode": "${ challenge.id }-documents",
2627
"discussions": [
2728
{
@@ -40,7 +41,7 @@
4041
},
4142
{
4243
"name": "Code Questions",
43-
"selfservice": false,
44+
"selfService": false,
4445
"urlcode": "${ challenge.id }-questions",
4546
"discussions": [
4647
{
@@ -53,7 +54,7 @@
5354
},
5455
{
5556
"name": "General Questions",
56-
"selfservice": true,
57+
"selfService": true,
5758
"urlcode": "${ challenge.id }-questions",
5859
"discussions": [
5960
{
@@ -73,13 +74,14 @@
7374
"group": {
7475
"name": "${ challenge.name }",
7576
"description": "Welcome to [${ challenge.name }](<%- challenge.url %>) Forum.",
77+
"selfServiceDescription": "Welcome to ${ challenge.name } Forum.",
7678
"privacy": "secret",
7779
"type": "challenge"
7880
},
7981
"categories": [
8082
{
8183
"name": "Code Documents",
82-
"selfservice": false,
84+
"selfService": false,
8385
"urlcode": "${ challenge.id }-documents",
8486
"discussions": [
8587
{
@@ -98,7 +100,7 @@
98100
},
99101
{
100102
"name": "Code Questions",
101-
"selfservice": false,
103+
"selfService": false,
102104
"urlcode": "${ challenge.id }-questions",
103105
"discussions": [
104106
{
@@ -111,7 +113,7 @@
111113
},
112114
{
113115
"name": "General Questions",
114-
"selfservice": true,
116+
"selfService": true,
115117
"urlcode": "${ challenge.id }-questions",
116118
"discussions": [
117119
{
@@ -137,6 +139,7 @@
137139
"group": {
138140
"name": "${ challenge.name }",
139141
"description": "Welcome to [${ challenge.name }](<%- challenge.url %>) Forum.",
142+
"selfServiceDescription": "Welcome to ${ challenge.name } Forum.",
140143
"privacy": "secret",
141144
"type": "challenge"
142145
},
@@ -146,35 +149,35 @@
146149
"body": "Spec Review Discussion",
147150
"announce": 0,
148151
"closed": 0,
149-
"selfservice": false
152+
"selfService": false
150153
},
151154
{
152155
"title": "Please give us feedback on this challenge!",
153156
"body": "Hi Competitors,\n\nAt topcoder, we are always trying to continuously improve how we are running competitions and tasks for our competitors. Part of this involves getting feedback from you on how well our tasks and challenges are being managed.\n\nPlease take 2-3 minutes to fill out this survey. The results will be used to identify areas of improvement, follow on training, procedural changes, etc. \n\n https://www.surveymonkey.com/r/3SYYTHP?Challenge_ID=<%- challenge.id %>",
154157
"announce": 0,
155158
"closed": 0,
156-
"selfservice": false
159+
"selfService": false
157160
},
158161
{
159162
"title": "Welcome!",
160163
"body": "Please read the requirements carefully. If you have questions, please let me know, I'll be glad to help you.",
161164
"announce": 0,
162165
"closed": 0,
163-
"selfservice": false
166+
"selfService": false
164167
},
165168
{
166169
"title": "Challenge Overview",
167170
"body": "[Back to Challenge Details page](<%- challenge.url %>)\n<% _.forEach(challenge.prizeSets, function(prizeSet) { %>* <%- prizeSet.type %>: <% _.forEach(prizeSet.prizes, function(prize) { %><%- prize.value %>$ <% }) %>\n<% }); %>",
168171
"announce": 1,
169172
"closed": 1,
170-
"selfservice": false
173+
"selfService": false
171174
},
172175
{
173176
"title": "Welcome!",
174177
"body": "Please read the requirements carefully. If you have questions, please let me know, I'll be glad to help you.",
175178
"announce": 0,
176179
"closed": 0,
177-
"selfservice": true
180+
"selfService": true
178181
}
179182
]
180183
}
@@ -191,13 +194,14 @@
191194
"group": {
192195
"name": "${ challenge.name }",
193196
"description": "Welcome to [${ challenge.name }](<%- challenge.url %>) Forum.",
197+
"selfServiceDescription": "Welcome to ${ challenge.name } Forum.",
194198
"privacy": "secret",
195199
"type": "challenge"
196200
},
197201
"categories": [
198202
{
199203
"name": "Code Documents",
200-
"selfservice": false,
204+
"selfService": false,
201205
"urlcode": "${ challenge.id }-documents",
202206
"discussions": [
203207
{
@@ -216,7 +220,7 @@
216220
},
217221
{
218222
"name": "Code Questions",
219-
"selfservice": false,
223+
"selfService": false,
220224
"urlcode": "${ challenge.id }-questions",
221225
"discussions": [
222226
{
@@ -229,7 +233,7 @@
229233
},
230234
{
231235
"name": "General Questions",
232-
"selfservice": true,
236+
"selfService": true,
233237
"urlcode": "${ challenge.id }-questions",
234238
"discussions": [
235239
{

src/services/vanilla.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,11 @@ async function createVanillaGroup (challenge) {
199199

200200
logger.info(`Creating Vanilla entities for the '${challengeDetailsDiscussion.name}' discussion ....`)
201201

202+
const isSelfService = challenge.legacy.selfService && challenge.legacy.selfService === true ? true: false
202203
const groupNameTemplate = _.template(groupTemplate.group.name)
203-
const groupDescriptionTemplate = _.template(groupTemplate.group.description)
204+
const groupDescriptionTemplate = challenge.legacy.selfService ? _.template(groupTemplate.group.selfServiceDescription)
205+
: _.template(groupTemplate.group.description)
206+
204207
const { body: group } = await vanillaClient.createGroup({
205208
name: groupNameTemplate({ challenge }),
206209
privacy: groupTemplate.group.privacy,
@@ -239,9 +242,8 @@ async function createVanillaGroup (challenge) {
239242

240243
logger.info(`The '${challengeCategory.name}' category was created.`)
241244

242-
const isSelfService = challenge.legacy.selfService;
243245
if (groupTemplate.categories) {
244-
const categories = _.filter(groupTemplate.categories, ['selfservice', isSelfService] )
246+
const categories = _.filter(groupTemplate.categories, ['selfService', isSelfService])
245247
for (const item of categories) {
246248
const urlCodeTemplate = _.template(item.urlcode)
247249
const { body: childCategory } = await vanillaClient.createCategory({
@@ -257,7 +259,7 @@ async function createVanillaGroup (challenge) {
257259
}
258260

259261
if (groupTemplate.discussions) {
260-
const groupDiscussions = _.filter(groupTemplate.discussions, ['selfservice', isSelfService] )
262+
const groupDiscussions = _.filter(groupTemplate.discussions, ['selfService', isSelfService])
261263
await createDiscussions(group, challenge, groupDiscussions, challengeCategory)
262264
}
263265

0 commit comments

Comments
 (0)