[db] Fix total results for album group query

The query did not respect the filter and therefor always returned the
number of albums in the library and not the number of albums for the
given query.
This commit is contained in:
chme 2018-03-17 20:20:19 +01:00 committed by ejurgensen
parent 6bdcda1524
commit f1c7672426
1 changed files with 1 additions and 1 deletions

View File

@ -1692,7 +1692,7 @@ db_build_query_group_albums(struct query_params *qp)
if (!qc)
return NULL;
count = sqlite3_mprintf("SELECT COUNT(DISTINCT f.songalbumid) FROM files f WHERE f.disabled = 0;");
count = sqlite3_mprintf("SELECT COUNT(DISTINCT f.songalbumid) FROM files f %s;", qc->where);
query = sqlite3_mprintf("SELECT g.id, g.persistentid, f.album, f.album_sort, COUNT(f.id) as track_count, 1 as album_count, f.album_artist, f.songartistid, SUM(f.song_length) FROM files f JOIN groups g ON f.songalbumid = g.persistentid %s GROUP BY f.songalbumid %s %s %s;", qc->where, qc->having, qc->order, qc->index);
db_free_query_clause(qc);