idk is that work

This commit is contained in:
NoLogicAlan committed 2026-05-14 15:52:38 +03:00
1 parent 6b4bcf143c
commit 48bebc950d
2 files changed
+57 -13

No files matched your search

+4 -4
View File
@@ -864,9 +864,9 @@ export class LastFmManager {
try {
const pool = await this._getPool();
const [rows] = await pool.execute(
"SELECT linked_users FROM lastfm_stats WHERE id = 1"
"SELECT COUNT(*) AS total FROM lastfm_users"
);
const count = Number(rows[0]?.linked_users ?? 0);
const count = Number(rows[0]?.total ?? 0);
this._linkedUsersCache = count;
return count;
} catch {
@@ -879,9 +879,9 @@ export class LastFmManager {
try {
const pool = await this._getPool();
const [rows] = await pool.execute(
"SELECT stored_scrobbles FROM lastfm_stats WHERE id = 1"
"SELECT COALESCE(SUM(scrobble_count), 0) AS total FROM lastfm_users"
);
const total = Number(rows[0]?.stored_scrobbles ?? this._totalScrobblesCache ?? 0);
const total = Number(rows[0]?.total ?? this._totalScrobblesCache ?? 0);
this._totalScrobblesCache = total;
this._totalScrobblesCacheExpiry = Date.now() + 10 * 60 * 1000;
return total;