Skip to content

Commit

Permalink
Merge pull request #117 from topcoder-platform/develop
Browse files Browse the repository at this point in the history
Release fix for registrations on non-active challenges
  • Loading branch information
ThomasKranitsas committed Feb 1, 2023
2 parents bddbe14 + 7d2924f commit 37b439f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ install_dependency: &install_dependency
install_deploysuite: &install_deploysuite
name: Installation of install_deploysuite.
command: |
git clone --branch v1.4 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
git clone --branch v1.4.14 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
cp ./../buildscript/master_deploy.sh .
cp ./../buildscript/buildenv.sh .
cp ./../buildscript/awsconfiguration.sh .
Expand Down
4 changes: 4 additions & 0 deletions src/services/ResourceService.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,10 @@ async function init (currentUser, challengeId, resource, isCreated) {
throw new errors.BadRequestError('Cannot delete resources of a completed challenge!')
}

if (!_.get(challenge, 'task.isTask', false) && _.get(challenge, 'status') !== constants.ChallengeStatuses.Active && isCreated && resource.roleId === config.SUBMITTER_RESOURCE_ROLE_ID) {
throw new errors.BadRequestError(`Cannot create submitter resource on challenge with status ${_.get(challenge, 'status')}`)
}

// Prevent from creating more than 1 submitter resources on tasks
if (_.get(challenge, 'task.isTask', false) && isCreated && resource.roleId === config.SUBMITTER_RESOURCE_ROLE_ID) {
const existing = await getResources(currentUser, challengeId, config.SUBMITTER_RESOURCE_ROLE_ID, null, null, 1, 1)
Expand Down

0 comments on commit 37b439f

Please sign in to comment.