osu! goals: actually pass my play counts into the refresh (most-played list, weekly or on force)
All checks were successful
Deploy production / deploy (push) Successful in 1m13s

This commit is contained in:
2026-10-26 01:00:39 +00:00
parent 5e10ecf525
commit 5c6ce75409

View File

@@ -253,10 +253,27 @@ export async function refreshAllGoals(force = false) {
let refreshed = 0, let refreshed = 0,
failed = 0, failed = 0,
achieved = 0; achieved = 0;
for (const row of rows) { const matched = rows.filter((r) => r.matchStatus === 'matched' && r.beatmapId);
if (row.matchStatus !== 'matched') continue; // Play counts come from my most-played list (paged), so only with the weekly metadata.
const needPlays =
force ||
matched.some(
(r) =>
r.myPlayCount == null ||
!r.metadataAt ||
Date.now() - r.metadataAt.getTime() > METADATA_MAX_AGE
);
let plays: Map<number, number> | undefined;
if (needPlays) {
try { try {
const updated = await refreshGoal(row, force); plays = await fetchMyPlayCounts(new Set(matched.map((r) => r.beatmapId!)));
} catch (e) {
console.error(`[osu-goals] play counts: ${(e as Error).message}`);
}
}
for (const row of matched) {
try {
const updated = await refreshGoal(row, force, plays);
refreshed++; refreshed++;
if (updated.achievedAt && !row.achievedAt) achieved++; if (updated.achievedAt && !row.achievedAt) achieved++;
} catch (e) { } catch (e) {