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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect Title for Embedded GitHub Status Card #715

Open
WilliamZheng27 opened this issue Dec 3, 2024 · 3 comments
Open

Incorrect Title for Embedded GitHub Status Card #715

WilliamZheng27 opened this issue Dec 3, 2024 · 3 comments
Labels
bug Something isn't working effort:1 prio b

Comments

@WilliamZheng27
Copy link

Describe the bug
The number of hours shown by embedded GitHub status cards doesn't seem right (way too long for a single week). After checking the original program, it seems like it is actually Yearly summary, not weekly.
image
image
Ref: https://github.com/anuraghazra/github-readme-stats?tab=readme-ov-file#wakatime-stats-card

System information
Using wakapi.dev

  • Wakapi version: v2.12.2-946985e
  • Operating system: Linux
  • Database: MySQL
@muety
Copy link
Owner

muety commented Dec 4, 2024

Thanks for pointing that out! You can simply change the title by changing the custom_title URL query parameter. But I'll also fix the preset for consistency.

General question: do you think yearly or weekly stats would be preferable for the stats card? I actually tend to prefer weekly stats, because my yearly card is insanely large and doesn't really look good in a README.

@muety muety added bug Something isn't working prio b effort:1 labels Dec 4, 2024
@WilliamZheng27
Copy link
Author

Thanks for pointing that out! You can simply change the title by changing the custom_title URL query parameter. But I'll also fix the preset for consistency.

General question: do you think yearly or weekly stats would be preferable for the stats card? I actually tend to prefer weekly stats, because my yearly card is insanely large and doesn't really look good in a README.

I agree weekly status will make more sense for most use cases, but is it possible to make it configurable for users? e.g. weekly, monthly, quarterly or custom time range.

@muety
Copy link
Owner

muety commented Dec 8, 2024

Alright, had a look at this again. There was a related issue, #508, which was our reaction to github-readme-stats removing support for the range parameter, see anuraghazra/github-readme-stats#2707. Since then, the card will always display whatever time range you set under Settings -> Permissions -> Time Range. If you set it to -1, the card will display all your coding time stored in Wakapi (which is why mine is so huge).

The card display whatever the /stats endpoint returns, which, in turn, will output whatever you configured as the permitted time range. My preference would be to add support for ?range back into the readme github-readme-stats again. Otherwise, the only way to configure your card's time range is via Wakapi's settings, unfortunately.

Apart from that, the card title is still display wrong, regardless of the above discussion. I'll fix that soon!

Implementation notes to myself By default, the card's title will be set according to [here](https://github.com/anuraghazra/github-readme-stats/blob/3b2c8885fc27574ad1880932ad961548f7c2db4b/src/cards/wakatime-card.js#L382), unless overridden by the optional `custom_title`. Default title will be different for whatever `range` is returned by the stats endpoint, however, only `last_7_days`, `last_year` are supported besides the default generic title.

👉 There's no way for Wakapi to fully customize the title (e.g. to "All time"), unless the user passes a custom_title for their card.

👉 Simply remove the custom_title attribute from the URL preset to at least avoid confusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working effort:1 prio b
Projects
None yet
Development

No branches or pull requests

2 participants