From c35f4c5505de455c882fbcd5cb6a972c373452c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Charlier?= Date: Thu, 1 Dec 2016 15:43:40 +0100 Subject: [PATCH 1/2] Fix missing albums in recently added albums Some recently added albums could be not displayed if more than one album with the same name but from different bands exist. This patch adds the 'band' column to the grouping to make the distinction between two albums with the same name but from different bands. --- app/Controller/SongsController.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Controller/SongsController.php b/app/Controller/SongsController.php index ce23773..b64456c 100644 --- a/app/Controller/SongsController.php +++ b/app/Controller/SongsController.php @@ -154,7 +154,7 @@ public function albums() { if ($page == 1) { $latests = $this->Song->find('all', array( 'fields' => array('Song.id', 'Song.band', 'Song.album', 'Song.cover'), - 'group' => 'Song.album', + 'group' => array('Song.album', 'Song.band'), 'order' => 'Song.created DESC', 'limit' => 6 )); @@ -171,14 +171,14 @@ public function albums() { } else { $subQuery = $db->buildStatement( array( - 'fields' => array('MIN(subsong.id)', 'subsong.album'), + 'fields' => array('MIN(subsong.id)', 'subsong.album', 'subsong.band'), 'table' => $db->fullTableName($this->Song), 'alias' => 'subsong', - 'group' => 'subsong.album' + 'group' => array('subsong.album', 'subsong.band') ), $this->Song ); - $subQuery = ' (Song.id, Song.album) IN (' . $subQuery . ') '; + $subQuery = ' (Song.id, Song.album, Song.band) IN (' . $subQuery . ') '; if ($page == 1) { $latests = $this->Song->find('all', array( From c2fa6d9fcd3dc822f84f36adc4cecc9dd361acec Mon Sep 17 00:00:00 2001 From: atomiix Date: Sat, 17 Dec 2016 16:39:26 +0100 Subject: [PATCH 2/2] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 01372af..4832085 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ #### Bug / Security fixes: * Merge #215: Playlist title cannot be empty (Thanks to disc) +* Merge #236: Fix missing albums in recently added albums (Thanks to fcharlier) * Fix #207: Broken disc info on OGG files * Fix #199: Improve the message on the cli tool * Fix #196: Error on import when people mess with dates