@@ -465,32 +465,42 @@ exports.getSoftwareStatistics = {
465
465
} ) ;
466
466
results . submissions . forEach ( function ( row ) {
467
467
var data = result . Tracks [ row . category_name ] ;
468
- _ . extend ( data , {
469
- competitions : row . num_ratings ,
470
- submissions : row . submissions ,
471
- submissionRate : _ . getPercent ( row . submission_rate , 2 ) ,
472
- inquiries : row . num_ratings ,
473
- passedScreening : row . passed_screening ,
474
- screeningSuccessRate : _ . getPercent ( row . screening_success_rate , 2 ) ,
475
- passedReview : row . passed_review ,
476
- reviewSuccessRate : _ . getPercent ( row . review_success_rate , 2 ) ,
477
- appeals : row . appeals ,
478
- appealSuccessRate : _ . getPercent ( row . appeal_success_rate , 2 ) ,
479
- maximumScore : round2 ( row . max_score ) ,
480
- minimumScore : round2 ( row . min_score ) ,
481
- averageScore : round2 ( row . avg_score ) ,
482
- averagePlacement : round2 ( row . avg_placement ) ,
483
- wins : row . wins ,
484
- winPercentage : _ . getPercent ( row . win_percent , 2 )
485
- } ) ;
468
+ // NOTE: there are currently submissions without track data
469
+ if ( data ) {
470
+ _ . extend ( data , {
471
+ competitions : row . num_ratings ,
472
+ submissions : row . submissions ,
473
+ submissionRate : _ . getPercent ( row . submission_rate , 2 ) ,
474
+ inquiries : row . num_ratings ,
475
+ passedScreening : row . passed_screening ,
476
+ screeningSuccessRate : _ . getPercent ( row . screening_success_rate , 2 ) ,
477
+ passedReview : row . passed_review ,
478
+ reviewSuccessRate : _ . getPercent ( row . review_success_rate , 2 ) ,
479
+ appeals : row . appeals ,
480
+ appealSuccessRate : _ . getPercent ( row . appeal_success_rate , 2 ) ,
481
+ maximumScore : round2 ( row . max_score ) ,
482
+ minimumScore : round2 ( row . min_score ) ,
483
+ averageScore : round2 ( row . avg_score ) ,
484
+ averagePlacement : round2 ( row . avg_placement ) ,
485
+ wins : row . wins ,
486
+ winPercentage : _ . getPercent ( row . win_percent , 2 )
487
+ } ) ;
488
+ } else {
489
+ api . log ( "unable to update submission data. no track data for handle " + handle + " in category " + row . category_name , "warning" ) ;
490
+ }
486
491
} ) ;
487
492
488
493
results . rating . forEach ( function ( row ) {
489
494
var data = result . Tracks [ row . category_name ] ;
490
- _ . extend ( data , {
491
- maximumRating : row . max_rating ,
492
- minimumRating : row . min_rating
493
- } ) ;
495
+ // there may not be a track
496
+ if ( data ) {
497
+ _ . extend ( data , {
498
+ maximumRating : row . max_rating ,
499
+ minimumRating : row . min_rating
500
+ } ) ;
501
+ } else {
502
+ api . log ( "unable to update rating data. no track data for handle " + handle + " in category " + row . category_name , "warning" ) ;
503
+ }
494
504
} ) ;
495
505
496
506
results . copilotStats . forEach ( function ( track ) {
@@ -501,15 +511,19 @@ exports.getSoftwareStatistics = {
501
511
result . Tracks [ track . category_name ] = { } ;
502
512
}
503
513
var data = result . Tracks [ track . category_name ] , copilotFulfillment ;
504
- if ( ! helper . checkNumber ( track . reviewer_rating ) ) {
505
- data . reviewerRating = track . reviewer_rating ;
506
- }
507
- if ( track . completed_contests !== 0 ) {
508
- data . copilotCompletedContests = track . completed_contests ;
509
- data . copilotRepostedContests = track . reposted_contests ;
510
- data . copilotFailedContests = track . failed_contests ;
511
- copilotFulfillment = 1 - data . copilotFailedContests / data . copilotCompletedContests ;
512
- data . copilotFulfillment = _ . getPercent ( copilotFulfillment , 0 ) ;
514
+ if ( data ) {
515
+ if ( ! helper . checkNumber ( track . reviewer_rating ) ) {
516
+ data . reviewerRating = track . reviewer_rating ;
517
+ }
518
+ if ( track . completed_contests !== 0 ) {
519
+ data . copilotCompletedContests = track . completed_contests ;
520
+ data . copilotRepostedContests = track . reposted_contests ;
521
+ data . copilotFailedContests = track . failed_contests ;
522
+ copilotFulfillment = 1 - data . copilotFailedContests / data . copilotCompletedContests ;
523
+ data . copilotFulfillment = _ . getPercent ( copilotFulfillment , 0 ) ;
524
+ }
525
+ } else {
526
+ api . log ( "unable to update copilot data. no track data for handle " + handle + " for track " + track , "warning" ) ;
513
527
}
514
528
} ) ;
515
529
cb ( ) ;
0 commit comments