Compare commits

..

1 Commits

2 changed files with 19 additions and 13 deletions

View File

@ -400,16 +400,23 @@ func (r *artistRepository) RefreshStats(allArtists bool) (int64, error) {
// This now calculates per-library statistics and stores them in library_artist.stats // This now calculates per-library statistics and stores them in library_artist.stats
batchUpdateStatsSQL := ` batchUpdateStatsSQL := `
WITH artist_role_counters AS ( WITH artist_role_counters AS (
SELECT mfa.artist_id, SELECT jt.atom AS artist_id,
mf.library_id, mf.library_id,
mfa.role, substr(
replace(jt.path, '$.', ''),
1,
CASE WHEN instr(replace(jt.path, '$.', ''), '[') > 0
THEN instr(replace(jt.path, '$.', ''), '[') - 1
ELSE length(replace(jt.path, '$.', ''))
END
) AS role,
count(DISTINCT mf.album_id) AS album_count, count(DISTINCT mf.album_id) AS album_count,
count(DISTINCT mf.id) AS count, count(mf.id) AS count,
sum(mf.size) AS size sum(mf.size) AS size
FROM media_file_artists mfa FROM media_file mf
JOIN media_file mf ON mfa.media_file_id = mf.id JOIN json_tree(mf.participants) jt ON jt.key = 'id' AND jt.atom IS NOT NULL
WHERE mfa.artist_id IN (ROLE_IDS_PLACEHOLDER) -- Will replace with actual placeholders WHERE jt.atom IN (ROLE_IDS_PLACEHOLDER) -- Will replace with actual placeholders
GROUP BY mfa.artist_id, mf.library_id, mfa.role GROUP BY jt.atom, mf.library_id, role
), ),
artist_total_counters AS ( artist_total_counters AS (
SELECT mfa.artist_id, SELECT mfa.artist_id,
@ -438,16 +445,16 @@ func (r *artistRepository) RefreshStats(allArtists bool) (int64, error) {
), ),
combined_counters AS ( combined_counters AS (
SELECT artist_id, library_id, role, album_count, count, size FROM artist_role_counters SELECT artist_id, library_id, role, album_count, count, size FROM artist_role_counters
UNION ALL UNION
SELECT artist_id, library_id, role, album_count, count, size FROM artist_total_counters SELECT artist_id, library_id, role, album_count, count, size FROM artist_total_counters
UNION ALL UNION
SELECT artist_id, library_id, role, album_count, count, size FROM artist_participant_counter SELECT artist_id, library_id, role, album_count, count, size FROM artist_participant_counter
), ),
library_artist_counters AS ( library_artist_counters AS (
SELECT artist_id, SELECT artist_id,
library_id, library_id,
json_group_object( json_group_object(
role, replace(role, '"', ''),
json_object('a', album_count, 'm', count, 's', size) json_object('a', album_count, 'm', count, 's', size)
) AS counters ) AS counters
FROM combined_counters FROM combined_counters

View File

@ -127,7 +127,6 @@ const Player = () => {
/> />
), ),
locale: locale(translate), locale: locale(translate),
sortableOptions: { delay: 200, delayOnTouchOnly: true },
}), }),
[gainInfo, isDesktop, playerTheme, translate, playerState.mode], [gainInfo, isDesktop, playerTheme, translate, playerState.mode],
) )