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