github-readme-streak-stats icon indicating copy to clipboard operation
github-readme-streak-stats copied to clipboard

Occasionally doesn't show my full streak stats, just truncated ones

Open unixorn opened this issue 3 years ago • 11 comments

Describe the bug

Occasionally when I view my profile, the streak stats only go back to Feb 2016. Usually it's correct and shows back to 2014, but every so often I see it truncated.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://github.com/unixorn?tab=overview&from=2014-12-01&to=2014-12-31
  2. View the inline streak stats chart

Unfortunately it's intermittent, that will usually show the correct stats, it's only occasionally truncated.

Expected behavior

I expect it to always show the same correct stats

Screenshots incomplete-streak

Desktop (please complete the following information):

  • OS: macOS 12.5 (happened on 12.4 too)
  • Browser - I've seen it happen on both Chrome and Firefox

Additional context Add any other context about the problem here.

unixorn avatar Jul 29 '22 17:07 unixorn

The stats displayed on the card are directly from the GitHub API.

The reason this may happen is possibly due to timezone-related issues.

It seems from experimenting that the timezone used for the contribution dates is based on the user's last known timezone for the access token provided. I found that 2 of the tokens in the public token pool were last used in a different timezone, but the other four were last used in Denver. To attempt to fix the issue, I've made sure the other two tokens were used in Denver (where I'm located) so it should at least be consistent. (Note: due to caching it may take some time for this to go into effect).

If you self-host the cards using your own personal access token, it would likely resolve the issue as well.

Let me know if this helps or if you continue experiencing the issue.

DenverCoder1 avatar Jul 29 '22 23:07 DenverCoder1

Will do and thanks for looking into it. Since it's an intermittent thing, it's hard to check.

unixorn avatar Jul 30 '22 13:07 unixorn

I mentioned the issue to GitHub Support and they told me "all timestamps are in UTC and this is the expected behavior". If the ability to switch the timezone ever becomes possible, I will be sure to implement it, but for now it seems it is not.

You could always change the dates of commits to fill in the gaps if you think it should count when it didn't, but besides that I can't think of anything.

I'm still not sure why it would be intermittent, though, but I can't really make it any more reliable than the API itself.

DenverCoder1 avatar Aug 01 '22 13:08 DenverCoder1

Agreed, if the API is inconsistent you can't do much to cope with it.

unixorn avatar Aug 01 '22 16:08 unixorn

Hey @DenverCoder1,

I'm also having the same issue, How I can host the card by myself or how we can change it if I want to update the same? Screenshot 2022-08-03 at 5 04 25 PM Screenshot 2022-08-03 at 5 23 36 PM

sumanabhi avatar Aug 03 '22 11:08 sumanabhi

I'm also having the same issue, How I can host the card by myself or how we can change it if I want to update the same?

The issue again is that the GitHub API says that you have 0 contributions on August 2 even though the graph displays differently.

Based on the response from GitHub Support, I'm not sure that self hosting would make a difference, but if you want to try it anyway, there are instructions in the readme.

The only way I can think of is to either change the date of a past commit or create a new commit dated in the middle of the day on the day that is missing, for example

git commit --date="2022-08-02 12:00" -m "Test commit" --allow-empty

You may consider this to be "cheating" but for now there doesn't seem to be another way to make GitHub count it.

DenverCoder1 avatar Aug 03 '22 14:08 DenverCoder1

I just had this timezone thing happen to me.

Its still Aug. 20th, but its showing its the 21st on the pic.. WrongTimezone

Yohn avatar Aug 21 '22 02:08 Yohn

Definitely an intermittent issue, im getting it today but havent seen it in a long time. Seems like an issue with the GitHub API intermittently providing inaccurate/incomplete data. Just gotta wait it out I guess, will be back to normal by tomorrow I hope!

jgphilpott avatar Oct 24 '22 16:10 jgphilpott

i'm seeing something similar on my stats. As of just last week, my longest streak was 455, but today it's showing 293 and that appears to be capped by this year (1.1 - 10.20). My longest streak was actually beyond that...

Also, my total contributions seem to be capped for this year as well and i believe it use to be counted over a longer span.

eswat2 avatar Nov 16 '22 17:11 eswat2

eswat2

I think all you can do is just wait and it will go back to normal eventually ... seems like the issue is on GitHub's end.

jgphilpott avatar Nov 17 '22 06:11 jgphilpott

I recently discovered that occasionally the GitHub API was returning blank responses when several requests were sent in a short amount of time, possibly due to rate-limiting.

I have done some testing over the past few days and I believe most of the issues people have been having with missing contributions from past years should be resolved now. In #370, I made it so it will retry requests once if they fail which should greatly reduce the amount of times the streak is missing stats.

DenverCoder1 avatar Dec 08 '22 02:12 DenverCoder1