diff --git a/src/core/seller.cpp b/src/core/seller.cpp index 5e7edae..94d3a0d 100644 --- a/src/core/seller.cpp +++ b/src/core/seller.cpp @@ -30,15 +30,17 @@ std::string Seller::getLastName() const { return lastName_; } int Seller::getSellerNo() const { return sellerNo_; } -std::vector> Seller::getArticles(bool onlySold) +std::vector Seller::getArticles(bool onlySold) const { - std::vector> articles; + std::vector articles; for (const auto article : articles_) { if (onlySold && article->isSold()) { - articles.push_back(article); + articles.push_back(article.get()); } else if (!onlySold) { - articles.push_back(article); + articles.push_back(article.get()); } } return articles; -} \ No newline at end of file +} + +size_t Seller::soldArticles() const { return getArticles(true).size(); } \ No newline at end of file diff --git a/src/core/seller.h b/src/core/seller.h index 63aebb2..a713292 100644 --- a/src/core/seller.h +++ b/src/core/seller.h @@ -27,7 +27,8 @@ class Seller : public Entity std::string getLastName() const; int getSellerNo() const; int getNumberOfOfferedArticles() const; - std::vector> getArticles(bool onlySold = false); + size_t soldArticles() const; + std::vector getArticles(bool onlySold = false) const; private: int sellerNo_{-1};