@@ -690,23 +690,25 @@ router.get("/api/repos/:owner/:shortName/contributors", function (req, res) {
690690 if ( err ) return error ( res , err ) ;
691691 const substantiveContributors = { } ;
692692 const nonSubstantiveContributors = { } ;
693- docs . forEach ( function ( doc ) {
694- if ( doc . markedAsNonSubstantiveBy ) {
695- for ( const contributor of doc . contributors ) {
696- if ( ! nonSubstantiveContributors [ contributor ] ) {
697- nonSubstantiveContributors [ contributor ] = { name : contributor , prs : [ ] } ;
693+ docs
694+ . filter ( doc => doc . status === "closed" )
695+ . forEach ( function ( doc ) {
696+ if ( doc . markedAsNonSubstantiveBy ) {
697+ for ( const contributor of doc . contributors ) {
698+ if ( ! nonSubstantiveContributors [ contributor ] ) {
699+ nonSubstantiveContributors [ contributor ] = { name : contributor , prs : [ ] } ;
700+ }
701+ nonSubstantiveContributors [ contributor ] . prs . push ( { num : doc . num , lastUpdated : new Date ( ...doc . lastUpdated ) . toDateString ( ) } ) ;
698702 }
699- nonSubstantiveContributors [ contributor ] . prs . push ( doc . num ) ;
700- }
701- } else {
702- for ( const affiliationId in doc . affiliations ) {
703- if ( ! substantiveContributors [ affiliationId ] ) {
704- substantiveContributors [ affiliationId ] = { name : doc . affiliations [ affiliationId ] , prs : [ ] } ;
703+ } else {
704+ for ( const affiliationId in doc . affiliations ) {
705+ if ( ! substantiveContributors [ affiliationId ] ) {
706+ substantiveContributors [ affiliationId ] = { name : doc . affiliations [ affiliationId ] , prs : [ ] } ;
707+ }
708+ substantiveContributors [ affiliationId ] . prs . push ( { num : doc . num , lastUpdated : new Date ( ... doc . lastUpdated ) . toDateString ( ) } ) ;
705709 }
706- substantiveContributors [ affiliationId ] . prs . push ( doc . num ) ;
707710 }
708- }
709- } ) ;
711+ } ) ;
710712 res . json ( { substantiveContributors, nonSubstantiveContributors} ) ;
711713 } ) ;
712714} ) ;
0 commit comments