-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Challenge eligibility updates for v3 groups (#505)
* Improve challenge visibility control (#501) * IMPROVE CHALLENGE VISIBILITY CONTROL (https://www.topcoder.com/challenge-details/30057891/?type=develop) Verification guide: docs/Verification_Guide-Improve Challenge Visibility Control.doc * Restoring an accidentially modified file * Fixed the case with a challenge that doesn't have eligibility * Shared the eligibility verification with challengeRegistration. The eligibility check routine is now in challengeHelper and can be added anywhere by a couple of simple lines of code. * improve the query * update query for groups (#502) * Update queries (#503) improve logging for v3 api call * should use externalToken field name
- Loading branch information
Showing
23 changed files
with
1,046 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,8 @@ | |
* | ||
* The APIs to register a challenge (studio category or software category) for the current logged-in user. | ||
* | ||
* @version 1.7 | ||
* @author ecnu_haozi, xjtufreeman, bugbuka, flytoj2ee, muzehyun | ||
* @version 1.8 | ||
* @author ecnu_haozi, xjtufreeman, bugbuka, flytoj2ee, muzehyun, GFalcon | ||
* | ||
* changes in 1.1: | ||
* Combine Challenge Registration API(BUGR-11058) | ||
|
@@ -27,6 +27,9 @@ | |
* | ||
* changes in 1.7: | ||
* Avoid reliability info set if there is none for new user. | ||
* | ||
* changes in 1.8: | ||
* Added the verification of the challenge's eligibility | ||
*/ | ||
"use strict"; | ||
|
||
|
@@ -880,19 +883,31 @@ exports.registerChallenge = { | |
} else { | ||
api.helper.checkUserActivated(connection.caller.handle, api, connection.dbConnectionMap, function (err, inactive) { | ||
var fail = err || inactive; | ||
if (fail) cb(fail); | ||
else api.dataAccess.executeQuery('check_challenge_exists', {challengeId: challengeId}, connection.dbConnectionMap, cb); | ||
if (fail) { | ||
cb(fail); | ||
} else { | ||
api.dataAccess.executeQuery('check_challenge_exists', {challengeId: challengeId}, connection.dbConnectionMap, cb); | ||
} | ||
}, "You must activate your account in order to participate. Please check your e-mail in order to complete the activation process, or contact [email protected] if you did not receive an e-mail."); | ||
} | ||
}, function (result, cb) { | ||
if (result.length > 0) { | ||
if (result[0].is_studio) { | ||
registerStudioChallengeAction(api, connection, next); | ||
} else { | ||
registerSoftwareChallengeAction(api, connection, next); | ||
} | ||
} else { | ||
}, function(result, cb) { | ||
// If the challenge is not found in the tcs_catalog:project table, | ||
if (result.length === 0) { | ||
// Do nothing, do not register | ||
cb(); | ||
return; | ||
} | ||
var isStudio = result[0].isStudio !== 0; | ||
api.challengeHelper.checkUserChallengeEligibility(connection, challengeId, function (err) { | ||
cb(err, isStudio); | ||
}); | ||
}, function (isStudio, cb) { | ||
if (_.isUndefined(isStudio)) { | ||
cb(); | ||
} else if (isStudio) { | ||
registerStudioChallengeAction(api, connection, next); | ||
} else { | ||
registerSoftwareChallengeAction(api, connection, next); | ||
} | ||
} | ||
], function (err) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
DATABASE common_oltp; | ||
|
||
DELETE FROM user_group_xref WHERE group_id > 3330000 AND group_id < 3330100; | ||
DELETE FROM security_groups WHERE group_id > 3330000 AND group_id < 3330100; | ||
DELETE FROM group_contest_eligibility WHERE contest_eligibility_id > 1110000 AND contest_eligibility_id < 1110100; | ||
DELETE FROM contest_eligibility WHERE contest_eligibility_id > 1110000 AND contest_eligibility_id < 1110100; | ||
|
||
DATABASE informixoltp; | ||
|
||
-- UPDATE coder SET comp_country_code = NULL WHERE user_id = 132458; | ||
|
||
DATABASE tcs_catalog; | ||
|
||
DELETE FROM notification WHERE project_id > 1110000 AND project_id < 1110100; | ||
DELETE FROM project_result WHERE project_id > 1110000 AND project_id < 1110100; | ||
DELETE FROM project_user_audit WHERE project_id > 1110000 AND project_id < 1110100; | ||
DELETE FROM component_inquiry WHERE project_id > 1110000 AND project_id < 1110100; | ||
DELETE FROM resource_info WHERE resource_id IN (SELECT resource_id FROM resource WHERE project_id > 1110000 AND project_id < 1110100); | ||
DELETE FROM resource WHERE project_id > 1110000 AND project_id < 1110100; | ||
|
||
DELETE FROM project_info WHERE project_id > 1110000 AND project_id < 1110100; | ||
DELETE FROM comp_versions WHERE component_id = 3330333; | ||
DELETE FROM comp_catalog WHERE component_id = 3330333; | ||
DELETE FROM project_phase WHERE project_id > 1110000 AND project_id < 1110100; | ||
DELETE FROM project WHERE project_id > 1110000 AND project_id < 1110100; | ||
|
||
DELETE FROM review_item_comment WHERE review_item_comment_id > 7770000 AND review_item_id < 7770100; | ||
DELETE FROM review_item WHERE review_item_id > 5550000 AND review_item_id < 5550100; | ||
DELETE FROM review WHERE review_id > 4440000 AND review_id < 4440100; | ||
DELETE FROM scorecard_question WHERE scorecard_question_id = 3330333; | ||
DELETE FROM scorecard_section WHERE scorecard_section_id = 3330333; | ||
DELETE FROM scorecard_group WHERE scorecard_group_id = 3330333; | ||
DELETE FROM scorecard WHERE scorecard_id = 3330333; | ||
DELETE FROM submission WHERE submission_id > 2220000 AND submission_id < 2220100; | ||
DELETE FROM prize WHERE project_id > 2220000 AND project_id < 2220100; | ||
DELETE FROM upload WHERE project_id > 2220000 AND project_id < 2220100; | ||
DELETE FROM resource WHERE project_id > 2220000 AND project_id < 2220100; | ||
DELETE FROM project_phase WHERE project_id > 2220000 AND project_id < 2220100; | ||
DELETE FROM project WHERE project_id > 2220000 AND project_id < 2220100; |
Oops, something went wrong.