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

Commit aebd7d2

Browse files
committed
Merge pull request #392 from Ghost141/dev
dev
2 parents cbc7e9e + 34afb00 commit aebd7d2

37 files changed

+2092
-111
lines changed

actions/challenges.js

Lines changed: 2 additions & 2 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;
@@ -3684,7 +3684,7 @@ var getChallenges = function (api, connection, listType, isMyChallenges, next) {
36843684
sqlParams = _.extend(sqlParams, {
36853685
first_row_index: (pageIndex - 1) * pageSize,
36863686
page_size: pageSize,
3687-
sort_column: helper.getSortColumnDBName(sortColumn.toLowerCase()),
3687+
sort_column: helper.getSortColumnDBName(sortColumn),
36883688
sort_order: sortOrder.toLowerCase(),
36893689
track: type.category,
36903690
// Set the submission phase status id.

actions/memberStatistics.js

Lines changed: 6 additions & 84 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) {
@@ -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,

actions/srmChallenges.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2079,7 +2079,7 @@ function getPracticeProblems(api, connection, next) {
20792079
sqlParams = {
20802080
firstRowIndex: (pageIndex - 1) * pageSize,
20812081
pageSize: pageSize,
2082-
sortColumn: helper.getSortColumnDBName(sortColumn.toLowerCase()),
2082+
sortColumn: helper.getSortColumnDBName(sortColumn),
20832083
sortOrder: sortOrder.toLowerCase(),
20842084
userId: caller.userId
20852085
};

0 commit comments

Comments
 (0)