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

Commit f545599

Browse files
author
fireice.topcoder
committed
Merge branch 'dev' of github.com:cloudspokes/tc-api into dev
2 parents ba077e4 + e82591b commit f545599

File tree

124 files changed

+9787
-313
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+9787
-313
lines changed

actions/challenges.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,7 @@ var searchChallenges = function (api, connection, dbConnectionMap, community, ne
933933
sqlParams.firstRowIndex = (pageIndex - 1) * pageSize;
934934
sqlParams.pageSize = pageSize;
935935
sqlParams.sortColumn = sortColumn.toLowerCase();
936-
sqlParams.sortColumn = helper.getSortColumnDBName(sortColumn.toLowerCase());
936+
sqlParams.sortColumn = helper.getSortColumnDBName(sortColumn);
937937
sqlParams.sortOrder = sortOrder.toLowerCase();
938938
// Set the project type id
939939
sqlParams.project_type_id = challengeType.category;
@@ -2383,8 +2383,8 @@ var getChallengeResults = function (api, connection, dbConnectionMap, isStudio,
23832383
//Submission Links
23842384
if (isStudio) {
23852385
if (challengeRestrictions.show_submissions) {
2386-
resEl.submissionDownloadLink = api.config.tcConfig.designSubmissionLink + el.submission_id;
2387-
resEl.previewDownloadLink = api.config.tcConfig.designSubmissionLink + el.submission_id + "&sbt=small";
2386+
resEl.submissionDownloadLink = api.config.tcConfig.designSubmissionLink + el.submission_id + api.config.tcConfig.submissionDownloadLinkParams;
2387+
resEl.previewDownloadLink = api.config.tcConfig.designSubmissionLink + el.submission_id + api.config.tcConfig.previewDownloadLinkParams;
23882388
}
23892389
} else {
23902390
resEl.submissionDownloadLink = api.config.tcConfig.submissionLink + el.upload_id;
@@ -2406,7 +2406,7 @@ var getChallengeResults = function (api, connection, dbConnectionMap, isStudio,
24062406
if (isStudio) {
24072407
if (challengeRestrictions.show_submissions) {
24082408
result.finalFixes = _.map(res.finalFixes, function (ff) {
2409-
return api.config.tcConfig.designSubmissionLink + ff.submission_id;
2409+
return api.config.tcConfig.designSubmissionLink + ff.submission_id + api.config.tcConfig.submissionDownloadLinkParams;
24102410
});
24112411
}
24122412
} else {
@@ -3696,7 +3696,7 @@ var getChallenges = function (api, connection, listType, isMyChallenges, next) {
36963696
sqlParams = _.extend(sqlParams, {
36973697
first_row_index: (pageIndex - 1) * pageSize,
36983698
page_size: pageSize,
3699-
sort_column: helper.getSortColumnDBName(sortColumn.toLowerCase()),
3699+
sort_column: helper.getSortColumnDBName(sortColumn),
37003700
sort_order: sortOrder.toLowerCase(),
37013701
track: type.category,
37023702
// Set the submission phase status id.
@@ -3968,7 +3968,7 @@ var getUserSubmissions = function (api, connection, next) {
39683968
submission.download = api.config.tcConfig.submissionLink + item.upload_id;
39693969
delete submission.ranking;
39703970
} else {
3971-
submission.download = api.config.tcConfig.designSubmissionLink + item.submission_id;
3971+
submission.download = api.config.tcConfig.designSubmissionLink + item.submission_id + api.config.tcConfig.submissionDownloadLinkParams;
39723972
}
39733973
return submission;
39743974
});

actions/memberRegistration.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,8 @@ var HANDLE_ALPHABET = stringUtils.ALPHABET_ALPHA_EN + stringUtils.ALPHABET_DIGIT
7979
/**
8080
* The regular expression for email
8181
*/
82-
var emailPattern = new RegExp("(^[\\+_A-Za-z0-9-]+(\\.[\\+_A-Za-z0-9-]+)*@([A-Za-z0-9-])+((\\.com)"
83-
+ "|(\\.net)|(\\.org)|(\\.info)|(\\.edu)|(\\.mil)|(\\.gov)|(\\.biz)|(\\.ws)|(\\.us)|(\\.tv)|(\\.cc)"
84-
+ "|(\\.aero)|(\\.arpa)|(\\.coop)|(\\.int)|(\\.jobs)|(\\.museum)|(\\.name)|(\\.pro)|(\\.travel)|(\\.nato)"
85-
+ "|(\\..{2,3})|(\\.([A-Za-z0-9-])+\\..{2,3}))$)");
82+
var emailPattern = new RegExp("(^[\\+_A-Za-z0-9-]+(\\.[\\+_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,}$))");
83+
8684

8785
/**
8886
* The patterns for checking invalid handle

actions/memberStatistics.js

Lines changed: 7 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -63,48 +63,6 @@ var STUDIO_ID = 6;
6363
var OPENAIM_ID = 8;
6464
var HIGH_SCHOOL_ID = 3;
6565

66-
/**
67-
* check whether given user is activated.
68-
* @param {String} handle - the handle to check.
69-
* @param {Object} api - the action hero api object
70-
* @param {Object} dbConnectionMap - the database connection map
71-
* @param {Function<err>} callback - the callback function
72-
*/
73-
function checkCoderActivated(handle, api, dbConnectionMap, callback) {
74-
api.dataAccess.executeQuery('check_coder_activated', { handle: handle }, dbConnectionMap, function (err, result) {
75-
if (err) {
76-
callback(err, null);
77-
return;
78-
}
79-
if (result && result[0] && result[0].status === 'A') {
80-
callback(err, null);
81-
} else {
82-
callback(err, new BadRequestError('User is not activated.'));
83-
}
84-
});
85-
}
86-
87-
///**
88-
// * Check whether given user is activated.
89-
// * @param {String} handle - the handle to check.
90-
// * @param {Object} api - the action hero api object
91-
// * @param {Object} dbConnectionMap - the database connection map
92-
// * @param {Function<err>} callback - the callback function
93-
// */
94-
//function checkUserActivated(handle, api, dbConnectionMap, callback) {
95-
// api.dataAccess.executeQuery('check_user_activated', { handle: handle }, dbConnectionMap, function (err, result) {
96-
// if (err) {
97-
// callback(err, null);
98-
// return;
99-
// }
100-
// if (result && result[0] && result[0].status === 'A') {
101-
// callback(err, null);
102-
// } else {
103-
// callback(err, new BadRequestError('User is not activated.'));
104-
// }
105-
// });
106-
//}
107-
10866
/**
10967
* Update user preference.
11068
*
@@ -183,42 +141,6 @@ function updateDemographicResponse(key, value, questionId, userId, api, dbConnec
183141
}
184142

185143

186-
/**
187-
* Check if the user exist and activated.
188-
* @param {String} handle - the user handle.
189-
* @param {Object} api - the api object.
190-
* @param {Object} dbConnectionMap - the database connection map object.
191-
* @param {Function} callback - the callback function.
192-
* @since 1.10
193-
*/
194-
function checkUserExistAndActivate(handle, api, dbConnectionMap, callback) {
195-
async.waterfall([
196-
function (cb) {
197-
// check user existence and activated status.
198-
async.parallel({
199-
exist: function (cb) {
200-
api.helper.checkUserExists(handle, api, dbConnectionMap, cb);
201-
},
202-
activate: function (cb) {
203-
checkCoderActivated(handle, api, dbConnectionMap, cb);
204-
}
205-
}, cb);
206-
},
207-
function (results, cb) {
208-
// handle the error situation.
209-
if (results.exist) {
210-
cb(results.exist);
211-
return;
212-
}
213-
if (results.activate) {
214-
cb(results.activate);
215-
return;
216-
}
217-
cb();
218-
}
219-
], callback);
220-
}
221-
222144
/**
223145
* Get the user basic profile information.
224146
* @param {Object} api - the api object.
@@ -270,7 +192,7 @@ function getBasicUserProfile(api, handle, privateInfoEligibility, dbConnectionMa
270192
}
271193
});
272194
} else {
273-
checkUserExistAndActivate(handle, api, dbConnectionMap, cb);
195+
helper.checkCoderExistAndActivate(handle, api, dbConnectionMap, cb);
274196
}
275197
}, function (cb) {
276198
var execQuery = function (name) {
@@ -785,7 +707,7 @@ exports.getMarathonStatistics = {
785707
}
786708
async.waterfall([
787709
function (cb) {
788-
checkUserExistAndActivate(handle, api, dbConnectionMap, cb);
710+
helper.checkCoderExistAndActivate(handle, api, dbConnectionMap, cb);
789711
}, function (cb) {
790712
var executeQuery = function (sqlName, cbx) {
791713
api.dataAccess.executeQuery(sqlName, sqlParams, dbConnectionMap, cbx);
@@ -899,7 +821,7 @@ exports.getSoftwareStatistics = {
899821
cb();
900822
}
901823
}, function (cb) {
902-
checkUserExistAndActivate(handle, api, dbConnectionMap, cb);
824+
helper.checkCoderExistAndActivate(handle, api, dbConnectionMap, cb);
903825
}, function (cb) {
904826
var execQuery = function (name, cbx) {
905827
api.dataAccess.executeQuery(name,
@@ -1036,7 +958,7 @@ exports.getStudioStatistics = {
1036958

1037959
async.waterfall([
1038960
function (cb) {
1039-
checkUserExistAndActivate(handle, api, dbConnectionMap, cb);
961+
helper.checkCoderExistAndActivate(handle, api, dbConnectionMap, cb);
1040962
}, function (cb) {
1041963
api.dataAccess.executeQuery('get_studio_member_statistics_track', sqlParams, dbConnectionMap, cb);
1042964
}, function (results, cb) {
@@ -1105,7 +1027,7 @@ exports.getAlgorithmStatistics = {
11051027
}
11061028
async.waterfall([
11071029
function (cb) {
1108-
checkUserExistAndActivate(handle, api, dbConnectionMap, cb);
1030+
helper.checkCoderExistAndActivate(handle, api, dbConnectionMap, cb);
11091031
}, function (cb) {
11101032
var execQuery = function (name) {
11111033
return function (cbx) {
@@ -1406,7 +1328,7 @@ var getRecentWinningDesignSubmissions = function (api, connection, dbConnectionM
14061328
submissionDate: element.submission_date,
14071329
viewable: element.viewable.toLowerCase() === "true",
14081330
challengeId: element.challenge_id,
1409-
preview: api.config.tcConfig.designSubmissionLink + element.submission_id + "&sbt=small"
1331+
preview: api.config.tcConfig.designSubmissionLink + element.submission_id + api.config.tcConfig.previewDownloadLinkParams
14101332
};
14111333
if (!winningSubmission.viewable) {
14121334
delete winningSubmission.preview;
@@ -1498,7 +1420,7 @@ exports.getCopilotStatistics = {
14981420
cb();
14991421
}
15001422
}, function (cb) {
1501-
checkUserExistAndActivate(handle, api, dbConnectionMap, cb);
1423+
helper.checkCoderExistAndActivate(handle, api, dbConnectionMap, cb);
15021424
}, function (cb) {
15031425
var execQuery = function (name, cbx) {
15041426
api.dataAccess.executeQuery(name,

0 commit comments

Comments
 (0)