Commit 10a5e9ec authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen
Browse files

Artist: Fix albums fetching

parent 36991378
......@@ -85,9 +85,8 @@ std::vector<AlbumPtr> Artist::albums() const
{
if ( m_id == 0 )
return {};
static const std::string req = "SELECT alb.* FROM " + policy::AlbumTable::Name + " alb "
"LEFT JOIN AlbumArtistRelation aar ON aar.id_album = alb.id_album "
"WHERE aar.id_artist = ? ORDER BY alb.title";
static const std::string req = "SELECT * FROM " + policy::AlbumTable::Name + " alb "
"WHERE artist_id = ? ORDER BY title";
return Album::fetchAll( m_dbConnection, req, m_id );
}
......
......@@ -88,8 +88,8 @@ TEST_F( Artists, Albums )
ASSERT_NE( album1, nullptr );
ASSERT_NE( album2, nullptr );
album1->addArtist( artist );
album2->addArtist( artist );
album1->setAlbumArtist( artist.get() );
album2->setAlbumArtist( artist.get() );
auto albums = artist->albums();
ASSERT_EQ( albums.size(), 2u );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment