From a340900e8a1fac282d953fd4c7ac1ae9a459726e Mon Sep 17 00:00:00 2001 From: Fabiano Couto Date: Fri, 5 May 2023 18:12:28 -0300 Subject: [PATCH] fix(wakatime-fetcher): add default range to prevent user not found error (#2670) * feat(theme): add github_dark_dimmed theme * feat(theme): change github_dark_dimmed icon color * contrast ratio adjustment contrast ratio adjustment on github_dark_dimmed theme * feat(theme): readme preview * feat(theme): github themes next to each other * github themes next to each other * feat(RankIcon): add rank icon option * feat(RankIcon): extract rankIcon to icons file * feat(RankIcon): update readme * feat(RankIcon): test coverage * Update readme.md Co-authored-by: Rick Staa * add wakatime default range * update wakatime demos in readme with most active user * update wakatime demo in readme * remove &range=all_time from wakatime demos in readme --------- Co-authored-by: Rick Staa --- readme.md | 8 ++++---- src/fetchers/wakatime-fetcher.js | 4 +++- tests/fetchWakatime.test.js | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/readme.md b/readme.md index ae18c9e..a95022b 100644 --- a/readme.md +++ b/readme.md @@ -456,13 +456,13 @@ Change the `?username=` value to your [Wakatime](https://wakatime.com) username. ### Demo -[![willianrod's wakatime stats](https://github-readme-stats.vercel.app/api/wakatime?username=willianrod)](https://github.com/anuraghazra/github-readme-stats) +[![Harlok's wakatime stats](https://github-readme-stats.vercel.app/api/wakatime?username=Harlok)](https://github.com/anuraghazra/github-readme-stats) -[![willianrod's wakatime stats](https://github-readme-stats.vercel.app/api/wakatime?username=willianrod&hide_progress=true)](https://github.com/anuraghazra/github-readme-stats) +[![Harlok's wakatime stats](https://github-readme-stats.vercel.app/api/wakatime?username=Harlok&hide_progress=true)](https://github.com/anuraghazra/github-readme-stats) - Compact layout -[![willianrod's wakatime stats](https://github-readme-stats.vercel.app/api/wakatime?username=willianrod&layout=compact)](https://github.com/anuraghazra/github-readme-stats) +[![Harlok's wakatime stats](https://github-readme-stats.vercel.app/api/wakatime?username=Harlok&layout=compact)](https://github.com/anuraghazra/github-readme-stats) * * * @@ -520,7 +520,7 @@ Choose from any of the [default themes](#themes) - WakaTime card -[![willianrod's wakatime stats](https://github-readme-stats.vercel.app/api/wakatime?username=willianrod)](https://github.com/anuraghazra/github-readme-stats) +[![Harlok's wakatime stats](https://github-readme-stats.vercel.app/api/wakatime?username=Harlok)](https://github.com/anuraghazra/github-readme-stats) * * * diff --git a/src/fetchers/wakatime-fetcher.js b/src/fetchers/wakatime-fetcher.js index fa1f3d8..2af8fa9 100644 --- a/src/fetchers/wakatime-fetcher.js +++ b/src/fetchers/wakatime-fetcher.js @@ -14,7 +14,9 @@ const fetchWakatimeStats = async ({ username, api_domain, range }) => { const { data } = await axios.get( `https://${ api_domain ? api_domain.replace(/\/$/gi, "") : "wakatime.com" - }/api/v1/users/${username}/stats/${range || ""}?is_including_today=true`, + }/api/v1/users/${username}/stats/${ + range || "all_time" + }?is_including_today=true`, ); return data.data; diff --git a/tests/fetchWakatime.test.js b/tests/fetchWakatime.test.js index 47ca25b..04c01ba 100644 --- a/tests/fetchWakatime.test.js +++ b/tests/fetchWakatime.test.js @@ -105,7 +105,7 @@ describe("Wakatime fetcher", () => { const username = "anuraghazra"; mock .onGet( - `https://wakatime.com/api/v1/users/${username}/stats/?is_including_today=true`, + `https://wakatime.com/api/v1/users/${username}/stats/all_time?is_including_today=true`, ) .reply(200, wakaTimeData);