@@ -63,48 +63,6 @@ var STUDIO_ID = 6;
63
63
var OPENAIM_ID = 8 ;
64
64
var HIGH_SCHOOL_ID = 3 ;
65
65
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
-
108
66
/**
109
67
* Update user preference.
110
68
*
@@ -183,42 +141,6 @@ function updateDemographicResponse(key, value, questionId, userId, api, dbConnec
183
141
}
184
142
185
143
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
-
222
144
/**
223
145
* Get the user basic profile information.
224
146
* @param {Object } api - the api object.
@@ -270,7 +192,7 @@ function getBasicUserProfile(api, handle, privateInfoEligibility, dbConnectionMa
270
192
}
271
193
} ) ;
272
194
} else {
273
- checkUserExistAndActivate ( handle , api , dbConnectionMap , cb ) ;
195
+ helper . checkCoderExistAndActivate ( handle , api , dbConnectionMap , cb ) ;
274
196
}
275
197
} , function ( cb ) {
276
198
var execQuery = function ( name ) {
@@ -785,7 +707,7 @@ exports.getMarathonStatistics = {
785
707
}
786
708
async . waterfall ( [
787
709
function ( cb ) {
788
- checkUserExistAndActivate ( handle , api , dbConnectionMap , cb ) ;
710
+ helper . checkCoderExistAndActivate ( handle , api , dbConnectionMap , cb ) ;
789
711
} , function ( cb ) {
790
712
var executeQuery = function ( sqlName , cbx ) {
791
713
api . dataAccess . executeQuery ( sqlName , sqlParams , dbConnectionMap , cbx ) ;
@@ -899,7 +821,7 @@ exports.getSoftwareStatistics = {
899
821
cb ( ) ;
900
822
}
901
823
} , function ( cb ) {
902
- checkUserExistAndActivate ( handle , api , dbConnectionMap , cb ) ;
824
+ helper . checkCoderExistAndActivate ( handle , api , dbConnectionMap , cb ) ;
903
825
} , function ( cb ) {
904
826
var execQuery = function ( name , cbx ) {
905
827
api . dataAccess . executeQuery ( name ,
@@ -1036,7 +958,7 @@ exports.getStudioStatistics = {
1036
958
1037
959
async . waterfall ( [
1038
960
function ( cb ) {
1039
- checkUserExistAndActivate ( handle , api , dbConnectionMap , cb ) ;
961
+ helper . checkCoderExistAndActivate ( handle , api , dbConnectionMap , cb ) ;
1040
962
} , function ( cb ) {
1041
963
api . dataAccess . executeQuery ( 'get_studio_member_statistics_track' , sqlParams , dbConnectionMap , cb ) ;
1042
964
} , function ( results , cb ) {
@@ -1105,7 +1027,7 @@ exports.getAlgorithmStatistics = {
1105
1027
}
1106
1028
async . waterfall ( [
1107
1029
function ( cb ) {
1108
- checkUserExistAndActivate ( handle , api , dbConnectionMap , cb ) ;
1030
+ helper . checkCoderExistAndActivate ( handle , api , dbConnectionMap , cb ) ;
1109
1031
} , function ( cb ) {
1110
1032
var execQuery = function ( name ) {
1111
1033
return function ( cbx ) {
@@ -1498,7 +1420,7 @@ exports.getCopilotStatistics = {
1498
1420
cb ( ) ;
1499
1421
}
1500
1422
} , function ( cb ) {
1501
- checkUserExistAndActivate ( handle , api , dbConnectionMap , cb ) ;
1423
+ helper . checkCoderExistAndActivate ( handle , api , dbConnectionMap , cb ) ;
1502
1424
} , function ( cb ) {
1503
1425
var execQuery = function ( name , cbx ) {
1504
1426
api . dataAccess . executeQuery ( name ,
0 commit comments