@@ -63,48 +63,6 @@ var STUDIO_ID = 6;
6363var OPENAIM_ID = 8 ;
6464var 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 ,
0 commit comments