Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions scripts/fetch-user-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ async function fetchUserInfo(username) {
monthly: { rank: "--", change: 0 },
};

let streak = { current: 0, longest: 0, lastUpdated: null };

// 1. Fetch historical data, ranks, and badges in a single network pass
try {
const response = await fetchWithTimeout(rawUrl);
Expand All @@ -53,6 +55,9 @@ async function fetchUserInfo(username) {
if (data.leaderboardRanks) {
leaderboardRanks = data.leaderboardRanks;
}
if (data.streak) {
streak = data.streak;
}
}
} else {
console.warn(
Expand Down Expand Up @@ -87,6 +92,7 @@ async function fetchUserInfo(username) {

return {
username,
streak,
ranking,
leaderboardRanks,
contest,
Expand Down
Loading