Commit c8517b13 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Artist: Split sort request suffix generation in a separate method

parent 514c8ab2
......@@ -417,7 +417,14 @@ std::vector<ArtistPtr> Artist::listAll( MediaLibraryPtr ml, bool includeAll,
else
req += "nb_albums > 0";
req += " AND is_present != 0 ORDER BY ";
req += " AND is_present != 0";
req += sortRequest( sort, desc );
return fetchAll<IArtist>( ml, req );
}
std::string Artist::sortRequest( SortingCriteria sort, bool desc )
{
std::string req = " ORDER BY ";
switch ( sort )
{
default:
......@@ -425,7 +432,7 @@ std::vector<ArtistPtr> Artist::listAll( MediaLibraryPtr ml, bool includeAll,
}
if ( desc == true )
req += " DESC";
return fetchAll<IArtist>( ml, req );
return req;
}
}
......@@ -77,6 +77,9 @@ public:
static std::vector<ArtistPtr> listAll( MediaLibraryPtr ml, bool includeAll,
SortingCriteria sort, bool desc );
private:
static std::string sortRequest( SortingCriteria sort, bool desc );
private:
MediaLibraryPtr m_ml;
int64_t m_id;
......
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