json-import: show number of sellers

This commit is contained in:
Martin Brodbeck 2019-10-07 10:29:14 +02:00
parent acc8408b0a
commit 9e2d377195
3 changed files with 19 additions and 4 deletions

View file

@ -25,7 +25,7 @@ void JsonUtil::exportSellers(const std::filesystem::path& filePath, Marketplace*
file << root.dump(4) << std::endl;
}
void JsonUtil::importSellers(const std::filesystem::path& filePath, Marketplace* market)
std::size_t JsonUtil::importSellers(const std::filesystem::path& filePath, Marketplace* market)
{
for (auto& seller : market->getSellers()) {
seller->setState(Seller::State::DELETE);
@ -56,8 +56,9 @@ void JsonUtil::importSellers(const std::filesystem::path& filePath, Marketplace*
}
market->sortSellers();
market->storeToDb();
return market->getSellers().size() - 1; // minus 1 because we don't count the "special" seller
}
void JsonUtil::exportSales(const std::filesystem::path& filePath, Marketplace* market, int cashPointNo)

View file

@ -10,7 +10,7 @@ class JsonUtil
{
public:
static void exportSellers(const std::filesystem::path& filePath, Marketplace* market);
static void importSellers(const std::filesystem::path& filePath, Marketplace* market);
static std::size_t importSellers(const std::filesystem::path& filePath, Marketplace* market);
static void exportSales(const std::filesystem::path& filePath, Marketplace* market, int cashPointNo);
static void importSales(const std::filesystem::path& filePath, Marketplace* market, int cashPointNo);
};