Skip to content

Support self-service flag #71

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 1 commit into from
Jan 21, 2022
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
64 changes: 60 additions & 4 deletions config/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"categories": [
{
"name": "Code Documents",
"selfservice": false,
"urlcode": "${ challenge.id }-documents",
"discussions": [
{
Expand All @@ -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": [
{
Expand All @@ -64,6 +79,7 @@
"categories": [
{
"name": "Code Documents",
"selfservice": false,
"urlcode": "${ challenge.id }-documents",
"discussions": [
{
Expand All @@ -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": [
{
Expand Down Expand Up @@ -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
}
]
}
Expand All @@ -156,6 +197,7 @@
"categories": [
{
"name": "Code Documents",
"selfservice": false,
"urlcode": "${ challenge.id }-documents",
"discussions": [
{
Expand All @@ -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": [
{
Expand Down
9 changes: 6 additions & 3 deletions src/services/vanilla.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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) {
Expand Down