Create a fake user if not existing
This commit is contained in:
@@ -83,6 +83,12 @@ User::getAll(Wt::Dbo::Session& session)
|
||||
return std::vector<pointer>(res.begin(), res.end());
|
||||
}
|
||||
|
||||
User::pointer
|
||||
User::create(Wt::Dbo::Session& session)
|
||||
{
|
||||
return session.add(new User());
|
||||
}
|
||||
|
||||
User::pointer
|
||||
User::getById(Wt::Dbo::Session& session, id_type id)
|
||||
{
|
||||
|
||||
@@ -64,6 +64,9 @@ class User
|
||||
|
||||
typedef Wt::Dbo::ptr<User> pointer;
|
||||
|
||||
// utility
|
||||
static pointer create(Wt::Dbo::Session& session);
|
||||
|
||||
// accessors
|
||||
static pointer getById(Wt::Dbo::Session& session, id_type id);
|
||||
static std::vector<pointer> getAll(Wt::Dbo::Session& session);
|
||||
|
||||
@@ -101,6 +101,10 @@ LmsApplication::LmsApplication(const Wt::WEnvironment& env, Wt::Dbo::SqlConnecti
|
||||
Wt::Dbo::Transaction transaction(DboSession());
|
||||
|
||||
firstConnection = (Database::User::getAll(DboSession()).size() == 0);
|
||||
|
||||
// Create a fake user
|
||||
// TODO settings
|
||||
Database::User::create(DboSession());
|
||||
}
|
||||
|
||||
LMS_LOG(UI, DEBUG) << "Creating root widget. First connection = " << std::boolalpha << firstConnection;
|
||||
|
||||
@@ -120,7 +120,7 @@ Playlist::addSome()
|
||||
return;
|
||||
|
||||
bool moreResults;
|
||||
auto tracks = playlist->getTracks(_entriesContainer->count(), 20, moreResults);
|
||||
auto tracks = playlist->getTracks(_entriesContainer->count(), 50, moreResults);
|
||||
for (auto track : tracks)
|
||||
{
|
||||
Wt::WTemplate* entry = new Wt::WTemplate(Wt::WString::tr("template-playlist-entry"), _entriesContainer);
|
||||
|
||||
Reference in New Issue
Block a user