@@ -49,33 +49,41 @@ export default {
4949
5050      let  topContributors =  []; 
5151      const  orgRepos  =  await  this .getRepos (); 
52-       try  { 
53-         for  (let  i =  0 ; i <  orgRepos .length ; i++ ) { 
54-           const  contributors  =  await  this .getContributors (orgRepos[i].name ); 
55-           contributors .forEach (function (contributor ) { 
56-             if  (! topContributors .hasOwnProperty (contributor .author .login )) { 
57-               topContributors[contributor .author .login ] =  { 
58-                 name:  contributor .author .login , 
59-                 total:  contributor .total , 
60-                 weeks:  contributor .weeks , 
61-                 avatar:  contributor .author .avatar_url  
62-               }; 
63-             } else  { 
52+       for  (let  i =  0 ; i <  orgRepos .length ; i++ ) { 
53+         const  contributors  =  await  this .getContributors (orgRepos[i].name ); 
54+         for (let  j =  0 ; j <  contributors .length ; j++ ) { 
55+           let  contributor =  contributors[j]; 
56+           if  (! topContributors .hasOwnProperty (contributor .author .login )) { 
57+             topContributors[contributor .author .login ] =  { 
58+               name:  contributor .author .login , 
59+               total:  contributor .total , 
60+               weeks:  contributor .weeks , 
61+               avatar:  contributor .author .avatar_url  
62+             }; 
63+           } else  { 
64+             try  { 
6465              topContributors[contributor .author .login ].total  +=  
6566                contributor .total ; 
66-               for  (let  j =  0 ; j <  contributor .weeks .length ; j++ ) { 
67-                 topContributors[contributor .author .login ].weeks [j].c  +=  
68-                   contributor .weeks [j].c ; 
69-                 topContributors[contributor .author .login ].weeks [j].a  +=  
70-                   contributor .weeks [j].a ; 
71-                 topContributors[contributor .author .login ].weeks [j].d  +=  
72-                   contributor .weeks [j].d ; 
67+               for  (let  k =  0 ; k <  contributor .weeks .length ; k++ ) { 
68+                 if (topContributors[contributor .author .login ].weeks .length  <=  k) 
69+                   topContributors[contributor .author .login ].weeks .push ({ 
70+                     w:  contributor .weeks [k].w , 
71+                     a:  0 , 
72+                     d:  0 , 
73+                     c:  0  
74+                   }) 
75+                 topContributors[contributor .author .login ].weeks [k].c  +=  
76+                   contributor .weeks [k].c ; 
77+                 topContributors[contributor .author .login ].weeks [k].a  +=  
78+                   contributor .weeks [k].a ; 
79+                 topContributors[contributor .author .login ].weeks [k].d  +=  
80+                   contributor .weeks [k].d ; 
7381              } 
82+             } catch  (err) { 
83+               console .log (err) 
7484            } 
75-           });  
85+           } 
7686        } 
77-       } catch  (err) { 
78-         console .log (err); 
7987      } 
8088
8189      // store this 
0 commit comments