@@ -42,36 +42,40 @@ export default {
42
42
methods: {
43
43
async load (cutoff ) {
44
44
// Set org status as loading
45
- this .$store .commit (" SET_ORG_STATUS" , {orgName: this .orgName , status: false })
45
+ this .$store .commit (" SET_ORG_STATUS" , {
46
+ orgName: this .orgName ,
47
+ status: false
48
+ });
46
49
47
50
let topContributors = [];
48
51
const orgRepos = await this .getRepos ();
49
-
50
- for (let i = 0 ; i < orgRepos .length ; i++ ) {
51
- const contributors = await this .getContributors (orgRepos[i].name );
52
- console . log (orgRepos[i]. name );
53
- contributors . forEach ( function ( contributor ) {
54
- if ( ! topContributors . hasOwnProperty ( contributor .author .login )) {
55
- topContributors[ contributor .author .login ] = {
56
- name : contributor .author . login ,
57
- total : contributor .total ,
58
- weeks : contributor .weeks ,
59
- avatar : contributor . author . avatar_url
60
- };
61
- } else {
62
- topContributors[ contributor .author . login ]. total +=
63
- contributor .total ;
64
- for ( let j = 0 ; j < contributor .weeks . length ; j ++ ) {
65
- topContributors[ contributor .author . login ]. weeks [j].c +=
66
- contributor .weeks [j].c ;
67
- topContributors[ contributor .author . login ]. weeks [j].a +=
68
- contributor .weeks [j].a ;
69
- topContributors[ contributor .author . login ]. weeks [j].d +=
70
- contributor . weeks [j]. d ;
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 {
64
+ topContributors[ contributor . author . login ]. total +=
65
+ 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 ;
73
+ }
71
74
}
72
- }
73
- console .log (contributor);
74
- });
75
+ });
76
+ }
77
+ } catch (err) {
78
+ console .log (err);
75
79
}
76
80
77
81
// store this
@@ -84,15 +88,18 @@ export default {
84
88
this .$store .dispatch (" sortTopMonthCommits" );
85
89
this .$store .dispatch (" sortTopYearCommits" );
86
90
87
- topContributors = this .$store .getters .getTopCommits (this .orgName )
91
+ topContributors = this .$store .getters .getTopCommits (this .orgName );
88
92
89
93
for (let data in topContributors) {
90
94
if (cutoff <= 0 ) break ;
91
95
this .contributors .push (topContributors[data]);
92
96
cutoff-- ;
93
97
}
94
98
this .isLoading = false ;
95
- this .$store .commit (" SET_ORG_STATUS" , {orgName: this .orgName , status: true });
99
+ this .$store .commit (" SET_ORG_STATUS" , {
100
+ orgName: this .orgName ,
101
+ status: true
102
+ });
96
103
},
97
104
async getRepos () {
98
105
const res = await axios
@@ -130,7 +137,7 @@ export default {
130
137
</script >
131
138
132
139
<style >
133
- .contributor {
134
- padding-left : 25px ;
135
- }
140
+ .contributor {
141
+ padding-left : 25px ;
142
+ }
136
143
</style >
0 commit comments