@@ -74,7 +74,8 @@ fetch(API_USER, options)
7474
7575
7676 } )
77- getPullRequests ( technigoRepositories )
77+ drawChart ( technigoRepositories . length ) // Calling the chart
78+ getPullRequests ( technigoRepositories ) // Calling the pull req and commits function
7879 } )
7980
8081
@@ -88,24 +89,12 @@ const getPullRequests = (repos) => {
8889 . then ( res => res . json ( ) )
8990 . then ( data => {
9091 const commits = document . getElementById ( `commit-${ repo . name } ` )
91- //TODO
92- //1. Find only the PR that you made by comparing pull.user.login
93- // with repo.owner.login
92+
9493 const pulls = data . find ( ( pull ) => pull . user . login === repo . owner . login ) ;
95- // console.log(pulls)
96- // commits.innerHTML += `
97- // ${pulls.number}
98- // `
94+
9995 fetchCommits ( pulls . commits_url , repo . name )
10096 console . log ( pulls . commits_url )
10197
102-
103-
104- //2. Now you're able to get the commits for each repo by using
105- // the commits_url as an argument to call another function
106-
107- //3. You can also get the comments for each PR by calling
108- // another function with the review_comments_url as argument
10998 } )
11099 } )
111100 }
@@ -119,4 +108,11 @@ const getPullRequests = (repos) => {
119108 document . getElementById ( `commit-${ myRepoName } ` ) . innerHTML += data . length
120109
121110 } )
122- }
111+ }
112+
113+ // Center canvas/chart
114+ window . onload = window . onresize = function ( ) {
115+ const canvas = document . getElementById ( 'canvas' ) ;
116+ canvas . width = window . innerWidth * 0.8 ;
117+ canvas . height = window . innerHeight * 0.8 ;
118+ }
0 commit comments