Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Issue 551 add skipForum flag when creating challenge #554

Merged
merged 2 commits into from
Dec 24, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,27 @@ public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCo
*/
public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCompetition contest,
long tcDirectProjectId, Date regEndDate, Date multiRoundEndDate, Date endDate) throws ContestServiceException, PermissionServiceException;


/**
* <p>
* Creates a new <code>SoftwareCompetition</code> in the persistence.
* </p>
*
* @param tcSubject TCSubject instance contains the login security info for the current user
* @param contest the <code>SoftwareCompetition</code> to create as a contest
* @param tcDirectProjectId the TC direct project id. a <code>long</code> providing the ID of a client the new
* competition belongs to.
* @param regEndDate the registration end date
* @param multiRoundEndDate the end date for the multiround phase. No multiround if it's null.
* @param endDate the end date for submission phase. Can be null if to use default.
* @param skipForum true if skip forum creation
* @return the created <code>SoftwareCompetition</code> as a contest
* @throws IllegalArgumentException if the input argument is invalid.
* @throws ContestServiceException if an error occurs when interacting with the service layer.
*/
public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCompetition contest,
long tcDirectProjectId, Date regEndDate, Date multiRoundEndDate, Date endDate, boolean skipForum) throws ContestServiceException, PermissionServiceException;

/**
* <p>
* BURG-1716: We need to add a method to get software contest by project id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3663,6 +3663,37 @@ public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCo
public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCompetition contest,
long tcDirectProjectId, Date regEndDate, Date multiRoundEndDate, Date endDate)
throws ContestServiceException, PermissionServiceException {
return createSoftwareContest(
tcSubject, contest, tcDirectProjectId, regEndDate, multiRoundEndDate, endDate, false);
}

/**
* <p>
* Creates a new <code>SoftwareCompetition</code> in the persistence.
* </p>
*
* @param tcSubject TCSubject instance contains the login security info
* for the current user
* @param contest the <code>SoftwareCompetition</code> to create as a
* contest
* @param tcDirectProjectId the TC direct project id. a <code>long</code>
* providing the ID of a client the new competition
* belongs to.
* @param regEndDate the registration end date
* @param multiRoundEndDate the end date for the multiround phase. No multiround
* if it's null.
* @param endDate the end date for submission phase. Can be null if to
* use default.
* @param skipForum true if no need to create the forum
*
* @return the created <code>SoftwareCompetition</code> as a contest
* @throws IllegalArgumentException if the input argument is invalid.
* @throws ContestServiceException if an error occurs when interacting with the
* service layer.
*/
public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCompetition contest,
long tcDirectProjectId, Date regEndDate, Date multiRoundEndDate, Date endDate, boolean skipForum)
throws ContestServiceException, PermissionServiceException {
logger.debug("createSoftwareContest with information : [tcSubject = " + tcSubject.getUserId()
+ ", tcDirectProjectId =" + tcDirectProjectId + ", multiRoundEndDate = " + multiRoundEndDate + "]");

Expand Down Expand Up @@ -3715,7 +3746,7 @@ public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCo
checkBillingProjectCCA(contest);

// update the AssetDTO and update corresponding properties
createUpdateAssetDTO(tcSubject, contest);
createUpdateAssetDTO(tcSubject, contest, skipForum);

com.topcoder.management.resource.Resource[] contestResources = createContestResources(tcSubject, contest,
billingProjectId, requireApproval);
Expand Down Expand Up @@ -4015,10 +4046,11 @@ private boolean shouldAutoCreateBugHuntContest(SoftwareCompetition contest) {
* @param tcSubject TCSubject instance contains the login security info for the
* current user
* @param contest the contest
* @param skipForum true if no need to create forum
* @throws EntityNotFoundException if any error occurs
* @throws com.topcoder.catalog.service.PersistenceException if any error occurs
*/
private void createUpdateAssetDTO(TCSubject tcSubject, SoftwareCompetition contest) throws EntityNotFoundException,
private void createUpdateAssetDTO(TCSubject tcSubject, SoftwareCompetition contest, boolean skipForum) throws EntityNotFoundException,
com.topcoder.catalog.service.PersistenceException, DAOException, ConfigManagerException {
// check if it is going to create development contest
boolean isDevContest = isDevContest(contest);
Expand Down Expand Up @@ -4055,7 +4087,7 @@ else if (isDevContest) {
}
long forumId = 0;
// create forum
if (createForum) {
if (createForum && !skipForum) {
if (useExistingAsset && assetDTO.getForum() != null) {
forumId = assetDTO.getForum().getJiveCategoryId();
} else {
Expand Down