Skip to content
Closed
Show file tree
Hide file tree
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
10 changes: 5 additions & 5 deletions src/pages/CodingVerse.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ function runJavaScript(code, timeoutMs = 2000) {
const logs = [];
const errors = [];
const fakeconsole = {
log: (...args) => logs.push(args.map(formatValue).join(" ")),
error: (...args) => errors.push(args.map(formatValue).join(" ")),
log: (...args) => logs.push((args ?? []).map(formatValue).join(" ")),
error: (...args) => errors.push((args ?? []).map(formatValue).join(" ")),
warn: (...args) => logs.push("[WARN] " + args.map(formatValue).join(" ")),
info: (...args) => logs.push("[INFO] " + args.map(formatValue).join(" ")),
};
Expand Down Expand Up @@ -808,9 +808,9 @@ export const CodingVerse = () => {
if (todayUTCStr !== newLastCodingVerseSolveDate) {
const lastDateParts = newLastCodingVerseSolveDate.split("-");
const lastUTC = Date.UTC(
parseInt(lastDateParts[0]),
parseInt(lastDateParts[1]) - 1,
parseInt(lastDateParts[2]),
parseInt(lastDateParts[0], 10),
parseInt(lastDateParts[1], 10) - 1,
parseInt(lastDateParts[2], 10),
);
const diffDays = Math.floor(
(todayUTC - lastUTC) / (1000 * 60 * 60 * 24),
Expand Down
2 changes: 1 addition & 1 deletion src/services/rankHistoryService.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const saveRankSnapshot = async (uid, rank, totalPoints, timezone) => {
// Extract number from "#42" or similar
const numericRank =
typeof rank === "string" ? parseInt(rank.replace(/[^0-9]/g, ""), 10) : rank;
if (isNaN(numericRank)) return;
if (Number.isNaN(numericRank)) return;

const timeZone = resolveTimezone(timezone);
const todayStr = toLocalDateString(new Date(), timeZone);
Expand Down
6 changes: 3 additions & 3 deletions src/utils/githubRateLimit.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
* and returns structured rate limit info.
*/
export const parseRateLimitHeaders = (headers) => {
const remaining = parseInt(headers?.["x-ratelimit-remaining"] ?? -1);
const limit = parseInt(headers?.["x-ratelimit-limit"] ?? -1);
const resetTimestamp = parseInt(headers?.["x-ratelimit-reset"] ?? 0);
const remaining = parseInt(headers?.["x-ratelimit-remaining"] ?? -1, 10);
const limit = parseInt(headers?.["x-ratelimit-limit"] ?? -1, 10);
const resetTimestamp = parseInt(headers?.["x-ratelimit-reset"] ?? 0, 10);

const resetDate = resetTimestamp ? new Date(resetTimestamp * 1000) : null;
const resetInMs = resetDate ? resetDate.getTime() - Date.now() : 0;
Expand Down
Loading