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
All checks were successful
Deploy production / deploy (push) Successful in 1m13s
This commit is contained in:
@@ -253,10 +253,27 @@ export async function refreshAllGoals(force = false) {
|
||||
let refreshed = 0,
|
||||
failed = 0,
|
||||
achieved = 0;
|
||||
for (const row of rows) {
|
||||
if (row.matchStatus !== 'matched') continue;
|
||||
const matched = rows.filter((r) => r.matchStatus === 'matched' && r.beatmapId);
|
||||
// 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 {
|
||||
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++;
|
||||
if (updated.achievedAt && !row.achievedAt) achieved++;
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user