@@ -14,7 +14,7 @@ fetch(repos)
1414 . then ( data => {
1515
1616 //Fetching only the forked repos and the ones starts with "project" from my GitHub account.
17- const forkedRepos = data . filter ( repo => repo . fork && repo . name . startsWith ( 'project-guess-who ' ) )
17+ const forkedRepos = data . filter ( repo => repo . fork && repo . name . startsWith ( 'project' ) )
1818 // change back to only "project" later
1919
2020 //Username and userpic
@@ -30,7 +30,7 @@ fetch(repos)
3030 <p>The default branch is: ${ repo . default_branch } </p>
3131 <p>The latest push: ${ repo . pushed_at . substring ( 0 , 10 ) } </p>
3232 <p id="pull-${ repo . name } ">No pull request is yet made 🤷 </p>
33-
33+ <p id="commits- ${ repo . name } ">There are no commits yet...</p>
3434 </div>
3535 ` )
3636
@@ -40,13 +40,7 @@ fetch(repos)
4040 } )
4141
4242
43-
44-
45-
46-
4743//^^^^^^^^^^^^^^^^^ fetching pull requests ^^^^^^^^^^^^^^^^^^^^^^^^^^//
48-
49-
5044const getPullRequests = ( repos ) => {
5145 //Get all the PRs for each project.
5246 repos . forEach ( repo => {
@@ -59,28 +53,25 @@ const getPullRequests = (repos) => {
5953 document . getElementById ( `pull-${ repo . name } ` ) . innerHTML = `Pull request was made ${ hedvigsPulls [ 0 ] . created_at . substring ( 0 , 10 ) } ` ;
6054 //allt som skrivs inom parentesen efter get ElementById är en del av ID:t.
6155 console . log ( 'Hedvigs PULLS. Arrey med ett objekt' , hedvigsPulls )
62- getCommitsForPullRequests ( hedvigsPulls )
56+ getCommitsForPullRequests ( hedvigsPulls , repo )
6357
6458 } )
6559 } )
6660}
6761
68-
62+ //^^^^^^^^^^^^^^^ fetching commits from the pull requests ^^^^^^^^^^^^^^^^^//
6963//Funktionen skall ta infon från det sorterade pullrequestet(hedvigsPulls) och sortera fram mitt commit_url från det.
70- const getCommitsForPullRequests = ( pullRequests ) => {
64+ const getCommitsForPullRequests = ( pullRequests , repo ) => {
7165 pullRequests . forEach ( pullRequest => {
7266 console . log ( 'Kolla här på pullRequest' , pullRequest )
7367
7468 //borde visa ett pullrequest CHECK
7569 fetch ( pullRequest . commits_url )
7670 . then ( res => res . json ( ) )
7771 . then ( fetchedCommits => {
78- console . log ( 'kolla här 2:' , fetchedCommits
79- )
80-
81-
82-
83-
72+ console . log ( 'kolla här 2:' , fetchedCommits . length )
73+
74+ document . getElementById ( `commits-${ repo . name } ` ) . innerHTML = `Number of commits: ${ fetchedCommits . length } ` ;
8475 //Funktionen skall gå ner en nivå till och bara visa commits_URL
8576
8677 } )
0 commit comments