This repository was archived by the owner on Mar 4, 2025. It is now read-only.
File tree 2 files changed +25
-2
lines changed
2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change 189
189
return submission . type === CONSTANTS . SUBMISSION_TYPE_CONTEST && submission . placement ;
190
190
} ) , 'placement' ) . placement ;
191
191
}
192
- if ( challenge . track === 'DEVELOP' && challenge . subTrack === 'FIRST_2_FINISH' ) {
192
+ if ( challenge . track === 'DEVELOP' && challenge . subTrack === 'FIRST_2_FINISH'
193
+ && challenge . userDetails . submissions && challenge . userDetails . submissions . length > 0 ) {
193
194
challenge . highestPlacement = _ . min ( challenge . userDetails . submissions . filter ( function ( submission ) {
194
195
return submission . type === CONSTANTS . SUBMISSION_TYPE_CONTEST
195
196
&& submission . status === CONSTANTS . STATUS_ACTIVE && submission . placement ;
Original file line number Diff line number Diff line change @@ -326,7 +326,7 @@ describe('Challenge Service', function() {
326
326
expect ( challenge . userHasSubmitterRole ) . to . exist . to . true ;
327
327
} ) ;
328
328
329
- it ( 'processPastChallenges should process a not completed DEVELOP/FIRST_2_FINISH challenge ' , function ( ) {
329
+ it ( 'processPastChallenges should process a not completed (empty submissions) DEVELOP/FIRST_2_FINISH challenge ' , function ( ) {
330
330
var challenges = [
331
331
{
332
332
id : 30041345 ,
@@ -348,6 +348,28 @@ describe('Challenge Service', function() {
348
348
expect ( challenge . userHasSubmitterRole ) . to . exist . to . true ;
349
349
} ) ;
350
350
351
+ it ( 'processPastChallenges should process a not completed(null submissions) DEVELOP/FIRST_2_FINISH challenge ' , function ( ) {
352
+ var challenges = [
353
+ {
354
+ id : 30041345 ,
355
+ name : 'Mock Challenge 1' ,
356
+ track : 'DEVELOP' ,
357
+ subTrack : 'FIRST_2_FINISH' ,
358
+ userDetails : {
359
+ hasUserSubmittedForReview : false ,
360
+ roles : [ 'Submitter' ] ,
361
+ submissions : null
362
+ }
363
+ }
364
+ ] ;
365
+ ChallengeService . processPastChallenges ( challenges ) ;
366
+ var challenge = challenges [ 0 ] ;
367
+ expect ( challenge . highestPlacement ) . not . to . exist ;
368
+ expect ( challenge . wonFirst ) . to . exist . to . false ;
369
+ expect ( challenge . userStatus ) . to . exist . to . equal ( 'NOT_FINISHED' ) ;
370
+ expect ( challenge . userHasSubmitterRole ) . to . exist . to . true ;
371
+ } ) ;
372
+
351
373
it ( 'processPastChallenges should process a DEVELOP/FIRST_2_FINISH challenge for a non submitter user ' , function ( ) {
352
374
var challenges = [
353
375
{
You can’t perform that action at this time.
0 commit comments