diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index e238864..79057d2 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -1,6 +1,6 @@ -find_package(Boost 1.62 COMPONENTS date_time REQUIRED) +find_package(Boost 1.62 REQUIRED) find_package(SQLite3 REQUIRED) #set(CORE_HEADERS @@ -13,9 +13,8 @@ set(CORE_SOURCES entity.cpp seller.cpp article.cpp - sale.cpp ) add_library(core STATIC ${CORE_SOURCES}) -target_link_libraries(core Boost::boost Boost::date_time) +target_link_libraries(core Boost::boost) target_link_libraries(core sqlite3) \ No newline at end of file diff --git a/src/core/article.cpp b/src/core/article.cpp index b798fbb..b56c413 100644 --- a/src/core/article.cpp +++ b/src/core/article.cpp @@ -16,6 +16,4 @@ bool Article::isSold() { return salePtr_ ? true : false; } std::string Article::getDescription() { return description_; } -Seller* Article::getSeller() { return sellerPtr_.get(); } - -int Article::getPrice() { return price_; } \ No newline at end of file +Seller* Article::getSeller() { return sellerPtr_.get(); } \ No newline at end of file diff --git a/src/core/article.h b/src/core/article.h index 03ceaf0..4042924 100644 --- a/src/core/article.h +++ b/src/core/article.h @@ -9,7 +9,6 @@ #include class Seller; -class Sale; class Article : public Entity { @@ -25,7 +24,6 @@ class Article : public Entity std::string getDescription(); Seller* getSeller(); - int getPrice(); private: std::shared_ptr sellerPtr_{}; diff --git a/src/core/database.cpp b/src/core/database.cpp index bec8d37..086dfc9 100644 --- a/src/core/database.cpp +++ b/src/core/database.cpp @@ -184,7 +184,7 @@ unsigned int Database::storeSellers(std::vector& sellers) sqlite3_finalize(stmt); throw std::runtime_error(errMsg); } - seller.setState(Seller::State::OK); + seller.setState(Seller::State::CLEAN); ++count; sqlite3_finalize(stmt); } diff --git a/src/core/entity.h b/src/core/entity.h index 8f1f63f..786d393 100644 --- a/src/core/entity.h +++ b/src/core/entity.h @@ -9,7 +9,7 @@ class Entity { public: - enum class State { NEW, UPDATE, DELETE, OK }; + enum class State { NEW, UPDATED, CLEAN }; virtual ~Entity() = 0; const boost::uuids::uuid& getUuid() const { return uuid_; }; diff --git a/src/core/sale.cpp b/src/core/sale.cpp deleted file mode 100644 index 8407232..0000000 --- a/src/core/sale.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "sale.h" - -#include - -int Sale::sumInCents() -{ - int test = std::accumulate(articles_.begin(), articles_.end(), 0, - [](int a, Article* b) { return a + b->getPrice(); }); - return test; -} \ No newline at end of file diff --git a/src/core/sale.h b/src/core/sale.h index e4d016e..06f350d 100644 --- a/src/core/sale.h +++ b/src/core/sale.h @@ -1,21 +1,8 @@ #ifndef SALE_H #define SALE_H -#include "article.h" +class Sale : public Entity { -#include - -#include - -class Article; - -class Sale : public Entity -{ - public: - int sumInCents(); - private: - boost::posix_time::ptime systemTime_{boost::posix_time::second_clock::local_time()}; - std::vector articles_{}; }; #endif \ No newline at end of file diff --git a/test/test_database.cpp b/test/test_database.cpp index e4052c4..b2b4bf3 100644 --- a/test/test_database.cpp +++ b/test/test_database.cpp @@ -51,6 +51,6 @@ BOOST_AUTO_TEST_CASE(seller_states) std::cout << "Anzahl sellers: " << sellers.size() << "\n"; BOOST_TEST((sellers.at(0).getState() == Entity::State::NEW)); BOOST_TEST(db.storeSellers(sellers) == 1); - BOOST_TEST((sellers.at(0).getState() == Entity::State::OK)); + BOOST_TEST((sellers.at(0).getState() == Entity::State::CLEAN)); BOOST_TEST(db.storeSellers(sellers) == 0); } \ No newline at end of file diff --git a/test/test_seller.cpp b/test/test_seller.cpp index 2c0468f..b389820 100644 --- a/test/test_seller.cpp +++ b/test/test_seller.cpp @@ -35,5 +35,4 @@ BOOST_AUTO_TEST_CASE(with_article) { article->setDescription("Test article"); seller.addArticle(article); BOOST_TEST(seller.getArticles().at(0)->getDescription() == "Test article"); - BOOST_TEST(seller.soldArticles() == 0); } \ No newline at end of file