Fix regression when displaying tags of a track
This commit is contained in:
@@ -143,7 +143,7 @@ std::vector<Wt::Dbo::ptr<Release>>
|
||||
Artist::getReleases(const std::set<IdType>& clusterIds) const
|
||||
{
|
||||
assert(self());
|
||||
assert(self()->id() != Wt::Dbo::dbo_traits<Artist>::invalidId() );
|
||||
assert(IdIsValid(self()->id()));
|
||||
assert(session());
|
||||
|
||||
WhereClause where;
|
||||
@@ -188,7 +188,7 @@ std::vector<std::vector<Wt::Dbo::ptr<Cluster>>>
|
||||
Artist::getClusterGroups(std::vector<ClusterType::pointer> clusterTypes, std::size_t size) const
|
||||
{
|
||||
assert(self());
|
||||
assert(self()->id() != Wt::Dbo::dbo_traits<Artist>::invalidId() );
|
||||
assert(IdIsValid(self()->id()));
|
||||
assert(session());
|
||||
|
||||
WhereClause where;
|
||||
|
||||
@@ -87,6 +87,7 @@ std::vector<Wt::Dbo::ptr<PlaylistEntry>>
|
||||
Playlist::getEntries(int offset, int size, bool& moreResults) const
|
||||
{
|
||||
assert(session());
|
||||
assert(IdIsValid(self()->id()));
|
||||
|
||||
moreResults = false;
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ std::vector<Wt::Dbo::ptr<Artist>>
|
||||
Release::getArtists() const
|
||||
{
|
||||
assert(self());
|
||||
assert(self()->id() != Wt::Dbo::dbo_traits<Release>::invalidId() );
|
||||
assert(IdIsValid(self()->id()));
|
||||
assert(session());
|
||||
|
||||
Wt::Dbo::collection<Wt::Dbo::ptr<Artist>> res = session()->query<Wt::Dbo::ptr<Artist>>(
|
||||
|
||||
@@ -214,7 +214,7 @@ std::vector<std::vector<Cluster::pointer>>
|
||||
Track::getClusterGroups(std::vector<ClusterType::pointer> clusterTypes, std::size_t size) const
|
||||
{
|
||||
assert(self());
|
||||
assert(self()->id() != Wt::Dbo::dbo_traits<Artist>::invalidId() );
|
||||
assert(IdIsValid(self()->id()));
|
||||
assert(session());
|
||||
|
||||
WhereClause where;
|
||||
@@ -322,7 +322,7 @@ Cluster::pointer
|
||||
ClusterType::getCluster(std::string name) const
|
||||
{
|
||||
assert(self());
|
||||
assert(self()->id() != Wt::Dbo::dbo_traits<ClusterType>::invalidId() );
|
||||
assert(IdIsValid(self()->id()));
|
||||
assert(session());
|
||||
|
||||
return session()->find<Cluster>()
|
||||
@@ -334,7 +334,7 @@ std::vector<Cluster::pointer>
|
||||
ClusterType::getClusters() const
|
||||
{
|
||||
assert(self());
|
||||
assert(self()->id() != Wt::Dbo::dbo_traits<ClusterType>::invalidId() );
|
||||
assert(IdIsValid(self()->id()));
|
||||
assert(session());
|
||||
|
||||
Wt::Dbo::collection<Cluster::pointer> res = session()->find<Cluster>()
|
||||
|
||||
@@ -120,7 +120,7 @@ class ClusterType : public Wt::Dbo::Dbo<ClusterType>
|
||||
Wt::Dbo::collection< Wt::Dbo::ptr<Cluster> > _clusters;
|
||||
};
|
||||
|
||||
class Track : public Wt::Dbo::Dbo<Cluster>
|
||||
class Track : public Wt::Dbo::Dbo<Track>
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
@@ -23,5 +23,10 @@
|
||||
|
||||
namespace Database {
|
||||
using IdType = Wt::Dbo::dbo_default_traits::IdType;
|
||||
|
||||
static inline bool IdIsValid(IdType id)
|
||||
{
|
||||
return id != Wt::Dbo::dbo_default_traits::invalidId();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -136,15 +136,13 @@ Tracks::addSome()
|
||||
|
||||
entry->bindString("name", Wt::WString::fromUTF8(track->getName()), Wt::TextFormat::Plain);
|
||||
|
||||
auto artist = track->getArtist();
|
||||
if (artist)
|
||||
if (track->getArtist())
|
||||
{
|
||||
entry->setCondition("if-has-artist", true);
|
||||
entry->bindWidget("artist-name", LmsApplication::createArtistAnchor(track->getArtist()));
|
||||
}
|
||||
|
||||
auto release = track->getRelease();
|
||||
if (release)
|
||||
if (track->getRelease())
|
||||
{
|
||||
entry->setCondition("if-has-release", true);
|
||||
entry->bindWidget("release-name", LmsApplication::createReleaseAnchor(track->getRelease()));
|
||||
@@ -157,7 +155,7 @@ Tracks::addSome()
|
||||
Wt::WContainerWidget* clusterContainers = entry->bindNew<Wt::WContainerWidget>("clusters");
|
||||
{
|
||||
auto clusterTypes = getClusterTypesFromSetting(trackClusterTypesSetting);
|
||||
auto clusterGroups = release->getClusterGroups(clusterTypes, 1);
|
||||
auto clusterGroups = track->getClusterGroups(clusterTypes, 1);
|
||||
|
||||
for (auto clusters : clusterGroups)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user