@@ -98,16 +98,6 @@ var ALLOWABLE_SORT_COLUMN = [
98
98
"postingDate" , "numSubmissions" , "numRegistrants" , "currentPhaseRemainingTime" , "currentPhaseName" , "registrationOpen"
99
99
] ;
100
100
101
- /**
102
- * Represents a ListType enum
103
- */
104
- var ListType = { ACTIVE : "ACTIVE" , OPEN : "OPEN" , UPCOMING : "UPCOMING" , PAST : "PAST" } ;
105
-
106
- /**
107
- * Represents a predefined list of valid list type.
108
- */
109
- var ALLOWABLE_LIST_TYPE = [ ListType . ACTIVE , ListType . OPEN , ListType . UPCOMING , ListType . PAST ] ;
110
-
111
101
/**
112
102
* Represents Percentage of Placement Points for digital run
113
103
*/
@@ -118,24 +108,6 @@ var DR_POINT = [[1], [0.7, 0.3], [0.65, 0.25, 0.10], [0.6, 0.22, 0.1, 0.08], [0.
118
108
*/
119
109
var MAX_INT = 2147483647 ;
120
110
121
- /**
122
- * The list type and registration phase status map.
123
- */
124
- var LIST_TYPE_REGISTRATION_STATUS_MAP = { } ;
125
- LIST_TYPE_REGISTRATION_STATUS_MAP [ ListType . ACTIVE ] = [ 2 , 3 ] ;
126
- LIST_TYPE_REGISTRATION_STATUS_MAP [ ListType . OPEN ] = [ 2 ] ;
127
- LIST_TYPE_REGISTRATION_STATUS_MAP [ ListType . UPCOMING ] = [ 1 ] ;
128
- LIST_TYPE_REGISTRATION_STATUS_MAP [ ListType . PAST ] = [ 3 ] ;
129
-
130
- /**
131
- * The list type and project status map.
132
- */
133
- var LIST_TYPE_PROJECT_STATUS_MAP = { } ;
134
- LIST_TYPE_PROJECT_STATUS_MAP [ ListType . ACTIVE ] = [ 1 ] ;
135
- LIST_TYPE_PROJECT_STATUS_MAP [ ListType . OPEN ] = [ 1 ] ;
136
- LIST_TYPE_PROJECT_STATUS_MAP [ ListType . UPCOMING ] = [ 2 ] ;
137
- LIST_TYPE_PROJECT_STATUS_MAP [ ListType . PAST ] = [ 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 ] ;
138
-
139
111
/**
140
112
* This copilot posting project type id
141
113
*/
@@ -207,7 +179,7 @@ function validateInputParameter(helper, caller, challengeType, query, filter, pa
207
179
helper . checkPositiveInteger ( pageSize , "pageSize" ) ||
208
180
helper . checkMaxNumber ( pageSize , MAX_INT , 'pageSize' ) ||
209
181
helper . checkMaxNumber ( pageIndex , MAX_INT , 'pageIndex' ) ||
210
- helper . checkContains ( ALLOWABLE_LIST_TYPE , type . toUpperCase ( ) , "type" ) ||
182
+ helper . checkContains ( helper . ALLOWABLE_LIST_TYPE , type . toUpperCase ( ) , "type" ) ||
211
183
checkQueryParameterAndSortColumn ( helper , type , query , sortColumn ) ;
212
184
213
185
if ( _ . isDefined ( query . communityId ) ) {
@@ -480,7 +452,7 @@ var searchChallenges = function (api, connection, dbConnectionMap, community, ne
480
452
481
453
sortOrder = query . sortorder || "asc" ;
482
454
sortColumn = query . sortcolumn || DEFAULT_SORT_COLUMN ;
483
- listType = ( query . listtype || ListType . OPEN ) . toUpperCase ( ) ;
455
+ listType = ( query . listtype || helper . ListType . OPEN ) . toUpperCase ( ) ;
484
456
pageIndex = Number ( query . pageindex || 1 ) ;
485
457
pageSize = Number ( query . pagesize || 50 ) ;
486
458
@@ -508,8 +480,8 @@ var searchChallenges = function (api, connection, dbConnectionMap, community, ne
508
480
// Set the project type id
509
481
sqlParams . project_type_id = challengeType . category ;
510
482
// Set the submission phase status id.
511
- sqlParams . registration_phase_status = LIST_TYPE_REGISTRATION_STATUS_MAP [ listType ] ;
512
- sqlParams . project_status_id = LIST_TYPE_PROJECT_STATUS_MAP [ listType ] ;
483
+ sqlParams . registration_phase_status = helper . LIST_TYPE_REGISTRATION_STATUS_MAP [ listType ] ;
484
+ sqlParams . project_status_id = helper . LIST_TYPE_PROJECT_STATUS_MAP [ listType ] ;
513
485
sqlParams . userId = caller . userId || 0 ;
514
486
515
487
// Check the private challenge access
@@ -788,7 +760,7 @@ var getChallenge = function (api, connection, dbConnectionMap, isStudio, next) {
788
760
submissionEndDate : formatDate ( data . submission_end_date )
789
761
} ;
790
762
791
- if ( connection . action == "getChallenge" ) {
763
+ if ( connection . action === "getChallenge" ) {
792
764
challenge . type = isStudio ? 'design' : 'develop' ;
793
765
}
794
766
@@ -1023,7 +995,7 @@ var submitForDevelopChallenge = function (api, connection, dbConnectionMap, next
1023
995
console . log ( '-------------------------------------------' ) ;
1024
996
console . log ( stats . size + '\t' + api . config . submissionMaxSizeBytes ) ;
1025
997
console . log ( '-------------------------------------------' ) ;
1026
-
998
+
1027
999
if ( stats . size > api . config . submissionMaxSizeBytes ) {
1028
1000
cb ( new RequestTooLargeError (
1029
1001
"The submission file size is greater than the max allowed size: " + ( api . config . submissionMaxSizeBytes / 1024 ) + " KB."
@@ -1049,7 +1021,7 @@ var submitForDevelopChallenge = function (api, connection, dbConnectionMap, next
1049
1021
fileName : uploadId + "_" + fileName
1050
1022
} ) ;
1051
1023
api . dataAccess . executeQuery ( "insert_upload" , sqlParams , dbConnectionMap , cb ) ;
1052
- } , function ( notUsed , cb ) {
1024
+ } , function ( notUsed , cb ) {
1053
1025
//Now check if the contest is a CloudSpokes one and if it needs to submit the thurgood job
1054
1026
if ( ! _ . isUndefined ( thurgoodPlatform ) && ! _ . isUndefined ( thurgoodLanguage ) && type === 'final' ) {
1055
1027
//Make request to the thurgood job api url
@@ -1541,11 +1513,11 @@ exports.getChallenge = {
1541
1513
run : function ( api , connection , next ) {
1542
1514
if ( connection . dbConnectionMap ) {
1543
1515
api . log ( "Execute getChallenge#run" , 'debug' ) ;
1544
- api . dataAccess . executeQuery ( 'check_challenge_exists' , { challengeId : connection . params . contestId } , connection . dbConnectionMap , function ( err , result ) {
1516
+ api . dataAccess . executeQuery ( 'check_challenge_exists' , { challengeId : connection . params . contestId } , connection . dbConnectionMap , function ( err , result ) {
1545
1517
if ( err ) {
1546
1518
api . helper . handleError ( api , connection , err ) ;
1547
1519
next ( connection , true ) ;
1548
- } else if ( result . length == 0 ) {
1520
+ } else if ( result . length === 0 ) {
1549
1521
api . helper . handleError ( api , connection , new NotFoundError ( "Challenge not found." ) ) ;
1550
1522
next ( connection , true ) ;
1551
1523
} else {
@@ -1771,7 +1743,7 @@ var DEFAULT_FONT_URL = 'community.topcoder.com/studio/the-process/font-policy/';
1771
1743
* Gets the file type based on the file name extension. Return null if not found.
1772
1744
* @since 1.14
1773
1745
*
1774
- * @param {Object } file - The file name
1746
+ * @param {Object } fileName - The file name
1775
1747
* @param {Object } fileTypes - The file types from which to read
1776
1748
*/
1777
1749
var getFileType = function ( fileName , fileTypes ) {
0 commit comments