Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Wrong commit count #14

Closed
anshumanv opened this issue Jul 10, 2020 · 19 comments 路 Fixed by #211
Closed

Bug: Wrong commit count #14

anshumanv opened this issue Jul 10, 2020 · 19 comments 路 Fixed by #211
Labels
bug Something isn't working. help wanted Extra attention is needed.

Comments

@anshumanv
Copy link

Hey 馃憢

Cool project, is there a limitation to the number of commits/PRs it can fetch?

They seem to be off by quite a lot for instance -

image

In normal GitHub search -
image

@anshumanv anshumanv changed the title Bug: Invalid commit count Bug: Wrong commit count Jul 10, 2020
@anuraghazra
Copy link
Owner

Hmm it should be fine.. it fetches the data from Github GraphQL api so it can't be invalid. although it is possible that you contributed to github organizations and i think those are not counted. #1

Stat

@anshumanv
Copy link
Author

Ah okay, very strange because PRs count is close to correct but commit count is still far off even if you exclude org commits.

@anuraghazra
Copy link
Owner

@anshumanv i think i got it. the issue is that github only returns last years contribution commits

{
  user(login: "anshumanv") {
   contributionsCollection(from: "2016-08-13T14:31:00Z", to:"2020-07-10T08:35:06.094Z") {
      totalCommitContributions
    }
  }
}

I can set from and to variables in the query but github does not allow more than one year's contributions to be shown at once

I have to find a way to fix this. do you have any ideas on this?

@anuraghazra anuraghazra added the help wanted Extra attention is needed. label Jul 10, 2020
@anuraghazra
Copy link
Owner

@anshumanv what i did is that looped through all the years and fetched the commits individually and seems kinda close.

github-readme-issue

@anshumanv
Copy link
Author

Yes, this is the basic brute force solution but I think you'll run into API rate limit after a while if you do this for every user.

@anshumanv
Copy link
Author

Maybe you can give an option for users to use their own tokens?

@anuraghazra
Copy link
Owner

anuraghazra commented Jul 10, 2020

No i don't think i can hit the rate limit because it's already authenticated by the server... i set auth token in env.

@anuraghazra
Copy link
Owner

Also i don't think i can give users an option to add their own tokens because that would be a huge security vulnrability if someone did like this /api?username=abc&token=SECRET_TOKEN because the url would be public

@anshumanv
Copy link
Author

No i don't think i can hit the rate limit because it's already authenticated by the server... i set auth token in env.

Yep even that doesn't give you infinite requests 馃槃 , IIRC you get 5k req per hour which can work for now till this gets really popular.

@anshumanv
Copy link
Author

Also i don't think i can give users an option to add their own tokens because that would be a huge security vulnrability if someone did like this /api?username=abc&token=SECRET_TOKEN because the url would be public

Yes, only option is for user to host their own app but that seems like an overkill for now

@anshumanv
Copy link
Author

And anyways tokens in request params will be deprecated in near future. You have to send it in body.

@anuraghazra
Copy link
Owner

No i don't think i can hit the rate limit because it's already authenticated by the server... i set auth token in env.

Yep even that doesn't give you infinite requests , IIRC you get 5k req per hour which can work for now till this gets really popular.

Just hope not everyone would have commits from 1980's like yours 馃槅 your account will hit the api 42 times 馃槅

@anshumanv
Copy link
Author

Just hope not everyone would have commits from 1980's like yours 馃槅 your account will hit the api 42 times 馃槅

Lol, that was when in my 1st year I committed using a messed up system clock, forgot to revert it 馃槬

Maybe I should take care of it real quick 馃槢

@anuraghazra anuraghazra linked a pull request Jul 11, 2020 that will close this issue
@1UC1F3R616
Copy link

@anshumanv It's showing yearly commit for me I see not total from when I started
Is this a feture for future pr or I using some wrong parameter?

@anuraghazra
Copy link
Owner

@1UC1F3R616 it is currently shows 1years total commit, its a limitation of github api. checkout #15 for more info

@anuraghazra anuraghazra removed a link to a pull request Jul 14, 2020
@anuraghazra anuraghazra added the bug Something isn't working. label Jul 15, 2020
@omidnikrah
Copy link
Contributor

omidnikrah commented Jul 18, 2020

@anuraghazra I think, at the moment it's better to change "Total Commits:" to "Total Commits (last year):".

@vasugamdha

This comment has been minimized.

@anuraghazra

This comment has been minimized.

@anuraghazra
Copy link
Owner

Fixed in #211

gracecarrillo pushed a commit to gracecarrillo/github-readme-stats that referenced this issue Jan 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working. help wanted Extra attention is needed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants