Fix creating new db

This commit is contained in:
Martin Brodbeck 2018-10-09 08:04:47 +02:00
parent 6b9ac3d284
commit 7571ef6a13
2 changed files with 3 additions and 0 deletions

View file

@ -41,6 +41,8 @@ void Database::newDb()
{ {
namespace fs = std::filesystem; namespace fs = std::filesystem;
sqlite3_close(db_);
fs::path sourcePath = dbname_; fs::path sourcePath = dbname_;
fs::path destPath = sourcePath.parent_path() / sourcePath.stem(); fs::path destPath = sourcePath.parent_path() / sourcePath.stem();
destPath += std::string("_") += boost::posix_time::to_iso_string(boost::posix_time::second_clock::local_time()) += ".db"; destPath += std::string("_") += boost::posix_time::to_iso_string(boost::posix_time::second_clock::local_time()) += ".db";

View file

@ -62,6 +62,7 @@ MainWindow::MainWindow()
dynamic_cast<BasketModel*>(ui_.basketView->model())->cancelSale(); dynamic_cast<BasketModel*>(ui_.basketView->model())->cancelSale();
marketplace_->clear(); marketplace_->clear();
setSaleModel(); setSaleModel();
updateStatLabel();
}); });
ui_.sellerNoEdit->installEventFilter(this); ui_.sellerNoEdit->installEventFilter(this);