From d2fd2319d63ec43cf409a5983f9de41c1e21d91a Mon Sep 17 00:00:00 2001
From: sofiaannajonsson <84452023+sofiaannajonsson@users.noreply.github.com>
Date: Wed, 23 Feb 2022 15:48:46 +0100
Subject: [PATCH 1/9] completed steps 1-3
---
.gitignore | 1 +
code/index.html | 3 ++-
code/script.js | 47 +++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 50 insertions(+), 1 deletion(-)
create mode 100644 .gitignore
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..c80900c9
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+code/secret.js
\ No newline at end of file
diff --git a/code/index.html b/code/index.html
index 2fb5e0ae..74599ecb 100644
--- a/code/index.html
+++ b/code/index.html
@@ -14,7 +14,8 @@
+
+ `
+ })
+}
+
const fetchRepos = () => {
- fetch(API_URL, options)
+ fetch(repo_URL, options)
.then(res => res.json())
.then(data => {
const filteredRepos = data.filter(repo => repo.name.startsWith("project") && repo.fork === true)
- console.log(filteredRepos)
+ //console.log(filteredRepos)
filteredRepos.forEach((repo) => {
- projects.innerHTML += `
-
-
${repo.name}
-
Recent push: ${new Date(repo.pushed_at).toDateString()}
+ projectsWrapper.innerHTML += `
+
+
+
Branch: ${repo.default_branch}
+
Latest push: ${new Date(repo.pushed_at).toDateString()}
+
Number of commits:
`
})
+ getPullRequests(filteredRepos);
})
}
-fetchRepos()
-
-// const getPullRequests = (repos) => {
-// //Get all the PRs for each project.
-// repos.forEach(repo => {
-// fetch('https://api.github.com/repos/technigo/' + repo.name + '/pulls')
-// .then(res => res.json())
-// .then(data => {
-
-// //TODO
-// //1. Find only the PR that you made by comparing pull.user.login
-// // with repo.owner.login
-// //2. Now you're able to get the commits for each repo by using
-// // the commits_url as an argument to call another function
-// //3. You can also get the comments for each PR by calling
-// // another function with the review_comments_url as argument
-// })
-// })
-// }
\ No newline at end of file
+const getPullRequests = (allPullRequests) => {
+ allPullRequests.forEach(repo => {
+ fetch(`https://api.github.com/repos/Technigo/${repo.name}/pulls?per_page=100`)
+ .then(res => res.json())
+ .then(data => {
+ const myPullRequests = data.filter((pullRequest) => pullRequest.user.login === user)
+ console.log(myPullRequests)
+
+ //TODO
+ //2. Now you're able to get the commits for each repo by using
+ // the commits_url as an argument to call another function
+ //3. You can also get the comments for each PR by calling
+ // another function with the review_comments_url as argument
+ })
+ // fetchCommits(myPullRequest.commits_url, repo.name);
+ })
+ }
+
+// const fetchCommits = (myCommitsUrl, myRepoName) => {
+// fetch(myCommitsUrl)
+// .then((response) => response.json())
+// .then (data => {
+// document.getElementById(`commit-${myRepoName}`).innerHTML += data.length
+// });
+// }
+
+profileInfo()
+fetchRepos()
\ No newline at end of file
From 1f9e00d808c0e38da4b661612250b811e531a5f4 Mon Sep 17 00:00:00 2001
From: sofiaannajonsson <84452023+sofiaannajonsson@users.noreply.github.com>
Date: Wed, 23 Feb 2022 19:35:54 +0100
Subject: [PATCH 3/9] started on fetching commits
---
code/script.js | 33 +++++++++++++++++++--------------
1 file changed, 19 insertions(+), 14 deletions(-)
diff --git a/code/script.js b/code/script.js
index 0cb139d7..8ded3955 100644
--- a/code/script.js
+++ b/code/script.js
@@ -48,7 +48,7 @@ const fetchRepos = () => {
`
})
- getPullRequests(filteredRepos);
+ getPullRequests(filteredRepos); // varför är denna här??
})
}
@@ -57,26 +57,31 @@ const getPullRequests = (allPullRequests) => {
fetch(`https://api.github.com/repos/Technigo/${repo.name}/pulls?per_page=100`)
.then(res => res.json())
.then(data => {
- const myPullRequests = data.filter((pullRequest) => pullRequest.user.login === user)
- console.log(myPullRequests)
-
+ const myPullRequest = data.find((pull) => pull.user.login === repo.owner.login);
+ // here make a conditional if not your pull request
+ const myCommitsURL = myPullRequest.commits_url
+ const myCommentsURL = myPullRequest.comments_url
+ const repoName = myPullRequest.name
+ console.log(myPullRequest)
+ console.log(myCommitsURL, myCommentsURL)
+ fetchCommits(myCommitsURL, repoName); // varför är denna här??
+
//TODO
//2. Now you're able to get the commits for each repo by using
// the commits_url as an argument to call another function
//3. You can also get the comments for each PR by calling
// another function with the review_comments_url as argument
- })
- // fetchCommits(myPullRequest.commits_url, repo.name);
+ })
})
}
-// const fetchCommits = (myCommitsUrl, myRepoName) => {
-// fetch(myCommitsUrl)
-// .then((response) => response.json())
-// .then (data => {
-// document.getElementById(`commit-${myRepoName}`).innerHTML += data.length
-// });
-// }
+const fetchCommits = (myCommitsURL, repoName) => {
+ fetch(myCommitsURL, repoName)
+ .then((res) => res.json())
+ .then (data => {
+ document.getElementById(`commit-${repo.name}`).innerHTML += data.length
+ });
+}
-profileInfo()
+profileInfo() // få in denna någon annanstans?
fetchRepos()
\ No newline at end of file
From 296d634e6c4130c5d1578082893a92bdb41110e7 Mon Sep 17 00:00:00 2001
From: sofiaannajonsson <84452023+sofiaannajonsson@users.noreply.github.com>
Date: Thu, 24 Feb 2022 16:45:58 +0100
Subject: [PATCH 4/9] added a chart and continued on fetch commits
---
code/chart.js | 42 +-
code/index.html | 15 +-
code/script.js | 49 +-
code/style.css | 3 -
node_modules/.package-lock.json | 12 +
node_modules/chart.js/LICENSE.md | 9 +
node_modules/chart.js/README.md | 38 +
node_modules/chart.js/auto/auto.esm.d.ts | 4 +
node_modules/chart.js/auto/auto.esm.js | 5 +
node_modules/chart.js/auto/auto.js | 1 +
node_modules/chart.js/auto/package.json | 8 +
node_modules/chart.js/dist/chart.esm.js | 10627 +++++++++++++
node_modules/chart.js/dist/chart.js | 13269 ++++++++++++++++
node_modules/chart.js/dist/chart.min.js | 13 +
.../chart.js/dist/chunks/helpers.segment.js | 2503 +++
node_modules/chart.js/dist/helpers.esm.js | 7 +
.../chart.js/helpers/helpers.esm.d.ts | 1 +
node_modules/chart.js/helpers/helpers.esm.js | 1 +
node_modules/chart.js/helpers/helpers.js | 1 +
node_modules/chart.js/helpers/package.json | 8 +
node_modules/chart.js/package.json | 111 +
node_modules/chart.js/types/adapters.d.ts | 63 +
node_modules/chart.js/types/animation.d.ts | 33 +
node_modules/chart.js/types/basic.d.ts | 3 +
node_modules/chart.js/types/color.d.ts | 1 +
node_modules/chart.js/types/element.d.ts | 17 +
node_modules/chart.js/types/geometric.d.ts | 37 +
.../types/helpers/helpers.canvas.d.ts | 101 +
.../types/helpers/helpers.collection.d.ts | 20 +
.../chart.js/types/helpers/helpers.color.d.ts | 33 +
.../chart.js/types/helpers/helpers.core.d.ts | 157 +
.../chart.js/types/helpers/helpers.curve.d.ts | 34 +
.../chart.js/types/helpers/helpers.dom.d.ts | 20 +
.../types/helpers/helpers.easing.d.ts | 5 +
.../types/helpers/helpers.extras.d.ts | 23 +
.../types/helpers/helpers.interpolation.d.ts | 1 +
.../chart.js/types/helpers/helpers.intl.d.ts | 7 +
.../chart.js/types/helpers/helpers.math.d.ts | 17 +
.../types/helpers/helpers.options.d.ts | 61 +
.../chart.js/types/helpers/helpers.rtl.d.ts | 12 +
.../types/helpers/helpers.segment.d.ts | 1 +
.../chart.js/types/helpers/index.d.ts | 15 +
node_modules/chart.js/types/index.esm.d.ts | 3601 +++++
node_modules/chart.js/types/layout.d.ts | 65 +
node_modules/chart.js/types/utils.d.ts | 21 +
package-lock.json | 24 +
package.json | 5 +
47 files changed, 31068 insertions(+), 36 deletions(-)
create mode 100644 node_modules/.package-lock.json
create mode 100644 node_modules/chart.js/LICENSE.md
create mode 100644 node_modules/chart.js/README.md
create mode 100644 node_modules/chart.js/auto/auto.esm.d.ts
create mode 100644 node_modules/chart.js/auto/auto.esm.js
create mode 100644 node_modules/chart.js/auto/auto.js
create mode 100644 node_modules/chart.js/auto/package.json
create mode 100644 node_modules/chart.js/dist/chart.esm.js
create mode 100644 node_modules/chart.js/dist/chart.js
create mode 100644 node_modules/chart.js/dist/chart.min.js
create mode 100644 node_modules/chart.js/dist/chunks/helpers.segment.js
create mode 100644 node_modules/chart.js/dist/helpers.esm.js
create mode 100644 node_modules/chart.js/helpers/helpers.esm.d.ts
create mode 100644 node_modules/chart.js/helpers/helpers.esm.js
create mode 100644 node_modules/chart.js/helpers/helpers.js
create mode 100644 node_modules/chart.js/helpers/package.json
create mode 100644 node_modules/chart.js/package.json
create mode 100644 node_modules/chart.js/types/adapters.d.ts
create mode 100644 node_modules/chart.js/types/animation.d.ts
create mode 100644 node_modules/chart.js/types/basic.d.ts
create mode 100644 node_modules/chart.js/types/color.d.ts
create mode 100644 node_modules/chart.js/types/element.d.ts
create mode 100644 node_modules/chart.js/types/geometric.d.ts
create mode 100644 node_modules/chart.js/types/helpers/helpers.canvas.d.ts
create mode 100644 node_modules/chart.js/types/helpers/helpers.collection.d.ts
create mode 100644 node_modules/chart.js/types/helpers/helpers.color.d.ts
create mode 100644 node_modules/chart.js/types/helpers/helpers.core.d.ts
create mode 100644 node_modules/chart.js/types/helpers/helpers.curve.d.ts
create mode 100644 node_modules/chart.js/types/helpers/helpers.dom.d.ts
create mode 100644 node_modules/chart.js/types/helpers/helpers.easing.d.ts
create mode 100644 node_modules/chart.js/types/helpers/helpers.extras.d.ts
create mode 100644 node_modules/chart.js/types/helpers/helpers.interpolation.d.ts
create mode 100644 node_modules/chart.js/types/helpers/helpers.intl.d.ts
create mode 100644 node_modules/chart.js/types/helpers/helpers.math.d.ts
create mode 100644 node_modules/chart.js/types/helpers/helpers.options.d.ts
create mode 100644 node_modules/chart.js/types/helpers/helpers.rtl.d.ts
create mode 100644 node_modules/chart.js/types/helpers/helpers.segment.d.ts
create mode 100644 node_modules/chart.js/types/helpers/index.d.ts
create mode 100644 node_modules/chart.js/types/index.esm.d.ts
create mode 100644 node_modules/chart.js/types/layout.d.ts
create mode 100644 node_modules/chart.js/types/utils.d.ts
create mode 100644 package-lock.json
create mode 100644 package.json
diff --git a/code/chart.js b/code/chart.js
index 92e85a30..6c0d771e 100644
--- a/code/chart.js
+++ b/code/chart.js
@@ -1,4 +1,40 @@
-//DOM-selector for the canvas 👇
-const ctx = document.getElementById('chart').getContext('2d')
+// //DOM-selector for the canvas 👇
+const ctx = document.getElementById("chart").getContext("2d");
+Chart.defaults.font.size = 16;
+Chart.defaults.color = "#1E1E24";
+//Chart.defaults.font.family = 'Spectral', serif;
-//"Draw" the chart here 👇
+const drawChart = (amount) => {
+const labels = [
+ 'Projects done',
+ 'Projects to be done',
+
+ ];
+
+ const data = {
+ labels: labels,
+ datasets: [{
+ label: 'My First dataset',
+ data: [amount, 19-amount],
+ backgroundColor: ['#DCEED1', '#A18276' ],
+ borderColor: '#FFF8F0',
+ }]
+ };
+
+ const config = {
+ type: 'doughnut',
+ data: data,
+ options: {
+ responsive: true,
+ // maintainAspectRatio: false,
+ }
+ };
+
+ const myChart = new Chart(
+ document.getElementById('chart'),
+ config
+ );
+ // myChart() // varför är denna ej aktiverad? vad gör den?
+ }
+
+ console.log('test')
\ No newline at end of file
diff --git a/code/index.html b/code/index.html
index bf12d5fc..162ec262 100644
--- a/code/index.html
+++ b/code/index.html
@@ -6,18 +6,27 @@
Project GitHub Tracker
+
+
+
+
+
+
Projects:
-
+
-
+
+
+
+
-