Optimized the way we count albums for artists

This commit is contained in:
emeric
2023-11-17 08:57:08 +01:00
parent 0cc73ca022
commit f2515edc8b
4 changed files with 16 additions and 22 deletions
+2 -2
View File
@@ -82,8 +82,8 @@ namespace API::Subsonic
if (id3)
{
const auto releases{ Release::find(context.dbSession, Release::FindParameters {}.setArtist(artist->getId())) };
artistNode.setAttribute("albumCount", releases.results.size());
const std::size_t count{ Release::getCount(context.dbSession, Release::FindParameters {}.setArtist(artist->getId())) };
artistNode.setAttribute("albumCount", count);
}
if (const Wt::WDateTime dateTime{ Service<Feedback::IFeedbackService>::get()->getStarredDateTime(user->getId(), artist->getId()) }; dateTime.isValid())