Fix aggregated values (count, size, duration) in roll-up queries

This commit is contained in:
Deluan 2021-07-17 21:33:47 -04:00 committed by Deluan Quintão
parent 054b5eafdb
commit 21cd50d81c
2 changed files with 2 additions and 4 deletions

View file

@ -197,10 +197,9 @@ func (r *artistRepository) refresh(ids ...string) error {
"group_concat(f.mbz_album_artist_id , ' ') as mbz_artist_id",
"f.sort_album_artist_name as sort_artist_name", "f.order_album_artist_name as order_artist_name",
"sum(f.song_count) as song_count", "sum(f.size) as size",
"group_concat(ag.genre_id, ' ') as genre_ids").
"(select group_concat(genre_id, ' ') from album_genres where album_id = f.id) as genre_ids").
From("album f").
LeftJoin("artist a on f.album_artist_id = a.id").
LeftJoin("album_genres ag on ag.album_id = f.id").
Where(Eq{"f.album_artist_id": ids}).
GroupBy("f.album_artist_id").OrderBy("f.id")
err := r.queryAll(sel, &artists)