Skip to content

Commit 088544f

Browse files
authored
fix: fetch versus calendar outside org branch — versus param silently ignored when org is set (JhaSourav07#2213)
Fixes JhaSourav07#2192 ## Description In `app/api/streak/route.ts`, the `versus` calendar was only fetched inside the `else` branch (single user mode). When the `org` param was also set, the `versus` fetch was skipped entirely — `versusCalendar` remained `undefined`, the `else if (versus && versusCalendar)` condition was never true, and the response silently fell through to a normal single-user SVG with no error. Fixed by moving the `versus` fetch outside the `if (org) / else` block so it runs independently for both user and org modes. ## Pillar - [x] 🛠️ Other (Bug fix, refactoring, docs) ## Visual Preview N/A — API fix, no UI change. ## Checklist before requesting a review: - [x] I have read the `CONTRIBUTING.md` file. - [x] I have tested these changes locally (`localhost:3000/api/streak?user=YOUR_USERNAME`). - [x] I have run `npm run format` and `npm run lint` locally and resolved all errors. - [x] My commits follow the Conventional Commits format. - [ ] I have updated `README.md` if I added a new theme or URL parameter. - [x] I have starred the repo. - [x] I have made sure that I have only one commit to merge in this PR. - [x] The SVG output matches the CommitPulse "premium quality" aesthetic standard. - [ ] (Recommended) I joined the CommitPulse Discord community.
2 parents 92d0ad3 + ff5bb9c commit 088544f

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

app/api/streak/route.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -189,15 +189,16 @@ export async function GET(request: Request) {
189189
to,
190190
});
191191
calendar = userData.calendar;
192+
}
192193

193-
if (versus) {
194-
const versusData = await fetchGitHubContributions(versus, {
195-
bypassCache: refresh,
196-
from,
197-
to,
198-
});
199-
versusCalendar = versusData.calendar;
200-
}
194+
// Fetch versus calendar independently — works with both user and org modes
195+
if (versus) {
196+
const versusData = await fetchGitHubContributions(versus, {
197+
bypassCache: refresh,
198+
from,
199+
to,
200+
});
201+
versusCalendar = versusData.calendar;
201202
}
202203

203204
// ─── JSON output mode ──────────────────────────────────────────────────

0 commit comments

Comments
 (0)