@@ -204,7 +204,8 @@ async function createVanillaGroup (challenge) {
204
204
type : groupTemplate . group . type ,
205
205
description : groupDescriptionTemplate ( { challenge } ) ,
206
206
challengeID : `${ challenge . id } ` ,
207
- challengeUrl : `${ challenge . url } `
207
+ challengeUrl : `${ challenge . url } ` ,
208
+ archived : true
208
209
} )
209
210
210
211
if ( ! group . groupID ) {
@@ -229,7 +230,8 @@ async function createVanillaGroup (challenge) {
229
230
urlcode : `${ challenge . id } ` ,
230
231
parentCategoryID : parentCategory [ 0 ] . categoryID ,
231
232
displayAs : groupTemplate . categories ? constants . VANILLA . CATEGORY_DISPLAY_STYLE . CATEGORIES : constants . VANILLA . CATEGORY_DISPLAY_STYLE . DISCUSSIONS ,
232
- groupID : group . groupID
233
+ groupID : group . groupID ,
234
+ archived : true
233
235
} )
234
236
235
237
logger . info ( `The '${ challengeCategory . name } ' category was created` )
@@ -241,7 +243,8 @@ async function createVanillaGroup (challenge) {
241
243
name : item . name ,
242
244
urlcode : `${ urlCodeTemplate ( { challenge } ) } ` ,
243
245
parentCategoryID : challengeCategory . categoryID ,
244
- groupID : group . groupID
246
+ groupID : group . groupID ,
247
+ archived : true
245
248
} )
246
249
logger . info ( `The '${ item . name } ' category was created` )
247
250
await createDiscussions ( group , challenge , item . discussions , childCategory )
@@ -286,8 +289,25 @@ async function updateVanillaGroup (challenge) {
286
289
throw new Error ( 'Multiple groups were found for this challenge' )
287
290
}
288
291
292
+ if ( challenge . status === constants . TOPCODER . CHALLENGE_STATUSES . ACTIVE ) {
293
+ await vanillaClient . unarchiveGroup ( groups [ 0 ] . groupID )
294
+ logger . info ( `The group with groupID=${ groups [ 0 ] . groupID } was unarchived.` )
295
+ } else if ( _ . includes ( [ constants . TOPCODER . CHALLENGE_STATUSES . COMPLETED ,
296
+ constants . TOPCODER . CHALLENGE_STATUSES . CANCELLED ,
297
+ constants . TOPCODER . CHALLENGE_STATUSES . CANCELLED_FAILED_REVIEW ,
298
+ constants . TOPCODER . CHALLENGE_STATUSES . CANCELLED_FAILED_SCREENING ,
299
+ constants . TOPCODER . CHALLENGE_STATUSES . CANCELLED_ZERO_SUBMISSIONS ,
300
+ constants . TOPCODER . CHALLENGE_STATUSES . CANCELLED_WINNER_UNRESPONSIVE ,
301
+ constants . TOPCODER . CHALLENGE_STATUSES . CANCELLED_CLIENT_REQUEST ,
302
+ constants . TOPCODER . CHALLENGE_STATUSES . CANCELLED_REQUIREMENTS_INFEASIBLE ,
303
+ constants . TOPCODER . CHALLENGE_STATUSES . CANCELLED_ZERO_REGISTRATIONS ,
304
+ constants . TOPCODER . CHALLENGE_STATUSES . DELETED ] , challenge . status ) ) {
305
+ await vanillaClient . archiveGroup ( groups [ 0 ] . groupID )
306
+ logger . info ( `The group with groupID=${ groups [ 0 ] . groupID } was archived.` )
307
+ }
308
+
289
309
const { body : updatedGroup } = await vanillaClient . updateGroup ( groups [ 0 ] . groupID , { name : challenge . name } )
290
- logger . info ( `The group was updated: ${ JSON . stringify ( updatedGroup ) } ` )
310
+ logger . info ( `The group with groupID= ${ groups [ 0 ] . groupID } was updated: ${ JSON . stringify ( updatedGroup ) } ` )
291
311
292
312
const { body : groupCategory } = await vanillaClient . getCategoryByUrlcode ( `${ challenge . id } ` )
293
313
if ( ! groupCategory ) {
0 commit comments