Skip to content

Week 7: Github Tracker#72

Open
SteppbySteph wants to merge 14 commits intoTechnigo:mainfrom
SteppbySteph:main
Open

Week 7: Github Tracker#72
SteppbySteph wants to merge 14 commits intoTechnigo:mainfrom
SteppbySteph:main

Conversation

@SteppbySteph
Copy link
Copy Markdown

No description provided.

Comment on lines +12 to +15
This time I learned to ask for help sooner than later since I got stuck with fetching pull requests inside a function.
The problem was solved by nesting the fetch of API for pull requests inside the first fetch. Another problem I encountered was not knowing how to use the tokens correctly and how to make Netlify show my index.html site. But after some added information in the notion page the problem was easily fixed!
If I had more time I would try to play around with API:s more and presenting the data with another chart.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting and detailed description of problem solving.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for all your inputs, Josse. I am glad you found the comments to the code easy to follow too! :)

code/script.js Outdated
Comment on lines +11 to +16
const options = {
method: 'GET',
headers: {
Authorization: `token ${GITHUB_TOKEN}`
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work to implement the token and not give up even if obstacles during the "road". For the Authorization part, you don't have to have template literals - I saw that Karin had it in here code also - not really sure why and the reason for having the word "token" before the API const name, do you? Otherwise you've could just have written:

Suggested change
const options = {
method: 'GET',
headers: {
Authorization: `token ${GITHUB_TOKEN}`
}
}
const options = {
method: 'GET',
headers: {
Authorization: 'GITHUB_TOKEN'
}
}

Copy link
Copy Markdown

@Josse79 Josse79 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very well done Stephannie. I can see that you are careful when structuring and commenting your code - not leaving a single thing behind. Therefore it has been a pleasure to review your code. Be proud!

fetch(USER_PROFILE, options)
.then(res => res.json())
.then(data => {
const user = data.name
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think actually that we should have our github user name included (SteppbySteph) - that will be fetched by user.login. It might be due user name is unique in github and therefor easier for anyone to find the correct Stephannie Medenilla. Although in your case there was only one Stephannie Medenilla when I did a search :-) I can see that some of our teammates have both name and user name.

Comment on lines +44 to +65
// Creating constsant for my filtered repos
forkedRepos = data.filter((repo) => repo.name.startsWith('project-'))

// Creating variable to pass on to showChart().
allMyRepos = forkedRepos.length

// forEach function to create HTML elements & pull requests
forkedRepos.forEach((repo) => {

// Getting Repo Name
repoName = repo.name;

// Getting Most Recent Push Date which will be formated according to 'substr' method.
pushDate = repo.pushed_at.substr(0, 10)

// Getting the Default Branch
defaultBranch = repo.default_branch

// Getting the URL of the repo
urlRepo = repo.html_url

// Creating innerHTML to insert above info
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice commenting as this is difficult parts to get hold of if not explained.

Comment on lines +84 to +88
if(myPR) {
getCommitNr(myPR, repo.name)
} else {
document.getElementById(`commit-${repo.name}`).innerHTML += 'No pull request made'
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Short and smart coding!

Comment on lines +97 to +104
const getCommitNr = (myPull, myRepoName) => {
fetch(myPull.commits_url, options)
.then(res => res.json())
.then((commit) => {
document.getElementById(`commit-${myRepoName}`).innerHTML += `
<p> Number of commits: ${commit.length}</p>
`
})
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me, in my project, I think this part was difficult. You've made it excellent!

}

.project-container {
display: grid;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job to use both flex and grid in this CSS file.

Comment on lines +44 to +47
padding-left: 5vw;
padding-right: 5vw;
padding-top: 1vh;
padding-bottom: 5vh;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make it a little shorter, you've could have wrapped it up in one line.
I also attend to do a lot of unnecessary lines of code:-)

Suggested change
padding-left: 5vw;
padding-right: 5vw;
padding-top: 1vh;
padding-bottom: 5vh;
padding: 1vh 5vw 5vh 5vw;

Comment on lines +102 to +103
grid-template-columns: 90vw;
grid-template-rows: 1fr auto;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like something smart, have to read up on grid a little bit.

Comment on lines +24 to +27
plugins: {
legend: {
display: true,
position: 'bottom',
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Impressed that you found how to positioning the labels at the bottom of the chart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants