Fixed bugs introduced by trying to use DISCTINCT after ORDER BY.
This commit is contained in:
parent
8e145b244d
commit
32f99df53e
@ -423,7 +423,7 @@ public class DbApi {
|
|||||||
def whereClauses = []
|
def whereClauses = []
|
||||||
|
|
||||||
def newJoin
|
def newJoin
|
||||||
query.append('SELECT DISTINCT * FROM (SELECT mf.* FROM media_files mf ')
|
query.append('SELECT mf.* FROM media_files mf ')
|
||||||
|
|
||||||
if (params.artistId || params.playlistId) {
|
if (params.artistId || params.playlistId) {
|
||||||
joins << (newJoin = [
|
joins << (newJoin = [
|
||||||
@ -501,11 +501,11 @@ public class DbApi {
|
|||||||
if (orderClauses)
|
if (orderClauses)
|
||||||
query.append(' ORDER BY ').append(orderClauses.join(', '))
|
query.append(' ORDER BY ').append(orderClauses.join(', '))
|
||||||
|
|
||||||
query = query.append(') as filtered_sorted_media_files').toString()
|
query = query.toString()
|
||||||
logger.debug('Selecting media files.\n\tSQL: {}\n\tPARAMS: {}',
|
logger.debug('Selecting media files.\n\tSQL: {}\n\tPARAMS: {}',
|
||||||
query, sqlParams)
|
query, sqlParams)
|
||||||
return sql.rows(query, sqlParams).collect {
|
return sql.rows(query, sqlParams).collect {
|
||||||
recordToModel(MediaFile, it) } }
|
recordToModel(MediaFile, it) }.unique() }
|
||||||
|
|
||||||
public List<MediaFile> getUntaggedFiles() {
|
public List<MediaFile> getUntaggedFiles() {
|
||||||
String query = """
|
String query = """
|
||||||
|
Loading…
Reference in New Issue
Block a user