diff --git a/config/template.json b/config/template.json index eb06fb5..98a4ed4 100644 --- a/config/template.json +++ b/config/template.json @@ -21,6 +21,7 @@ "categories": [ { "name": "Code Documents", + "selfservice": false, "urlcode": "${ challenge.id }-documents", "discussions": [ { @@ -39,6 +40,20 @@ }, { "name": "Code Questions", + "selfservice": false, + "urlcode": "${ challenge.id }-questions", + "discussions": [ + { + "title": "Welcome!", + "body": "Please read the requirements carefully. If you have questions, please let me know, I'll be glad to help you.", + "announce": 0, + "closed": 0 + } + ] + }, + { + "name": "General Questions", + "selfservice": true, "urlcode": "${ challenge.id }-questions", "discussions": [ { @@ -64,6 +79,7 @@ "categories": [ { "name": "Code Documents", + "selfservice": false, "urlcode": "${ challenge.id }-documents", "discussions": [ { @@ -82,6 +98,20 @@ }, { "name": "Code Questions", + "selfservice": false, + "urlcode": "${ challenge.id }-questions", + "discussions": [ + { + "title": "Welcome!", + "body": "Please read the requirements carefully. If you have questions, please let me know, I'll be glad to help you.", + "announce": 0, + "closed": 0 + } + ] + }, + { + "name": "General Questions", + "selfservice": true, "urlcode": "${ challenge.id }-questions", "discussions": [ { @@ -115,25 +145,36 @@ "title": "Spec Review Discussion", "body": "Spec Review Discussion", "announce": 0, - "closed": 0 + "closed": 0, + "selfservice": false }, { "title": "Please give us feedback on this challenge!", "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 %>", "announce": 0, - "closed": 0 + "closed": 0, + "selfservice": false }, { "title": "Welcome!", "body": "Please read the requirements carefully. If you have questions, please let me know, I'll be glad to help you.", "announce": 0, - "closed": 0 + "closed": 0, + "selfservice": false }, { "title": "Challenge Overview", "body": "[Back to Challenge Details page](<%- challenge.url %>)\n<% _.forEach(challenge.prizeSets, function(prizeSet) { %>* <%- prizeSet.type %>: <% _.forEach(prizeSet.prizes, function(prize) { %><%- prize.value %>$ <% }) %>\n<% }); %>", "announce": 1, - "closed": 1 + "closed": 1, + "selfservice": false + }, + { + "title": "Welcome!", + "body": "Please read the requirements carefully. If you have questions, please let me know, I'll be glad to help you.", + "announce": 0, + "closed": 0, + "selfservice": true } ] } @@ -156,6 +197,7 @@ "categories": [ { "name": "Code Documents", + "selfservice": false, "urlcode": "${ challenge.id }-documents", "discussions": [ { @@ -174,6 +216,20 @@ }, { "name": "Code Questions", + "selfservice": false, + "urlcode": "${ challenge.id }-questions", + "discussions": [ + { + "title": "Welcome!", + "body": "Please read the requirements carefully. If you have questions, please let me know, I'll be glad to help you.", + "announce": 0, + "closed": 0 + } + ] + }, + { + "name": "General Questions", + "selfservice": true, "urlcode": "${ challenge.id }-questions", "discussions": [ { diff --git a/src/services/vanilla.js b/src/services/vanilla.js index 67eb8b9..0d34b55 100644 --- a/src/services/vanilla.js +++ b/src/services/vanilla.js @@ -237,10 +237,12 @@ async function createVanillaGroup (challenge) { archived: true }) - logger.info(`The '${challengeCategory.name}' category was created`) + logger.info(`The '${challengeCategory.name}' category was created.`) + const isSelfService = challenge.legacy.selfService; if (groupTemplate.categories) { - for (const item of groupTemplate.categories) { + const categories = _.filter(groupTemplate.categories, ['selfservice', isSelfService] ) + for (const item of categories) { const urlCodeTemplate = _.template(item.urlcode) const { body: childCategory } = await vanillaClient.createCategory({ name: item.name, @@ -255,7 +257,8 @@ async function createVanillaGroup (challenge) { } if (groupTemplate.discussions) { - await createDiscussions(group, challenge, groupTemplate.discussions, challengeCategory) + const groupDiscussions = _.filter(groupTemplate.discussions, ['selfservice', isSelfService] ) + await createDiscussions(group, challenge, groupDiscussions, challengeCategory) } for (const member of members) {