Fix Excel import
This commit is contained in:
parent
77791e142c
commit
2d06de9907
1 changed files with 4 additions and 11 deletions
|
@ -22,20 +22,14 @@ std::size_t ExcelReader::readSellersFromFile(const fs::path& filePath, Marketpla
|
|||
market->storeToDb(true);
|
||||
auto ws = wb.sheet_by_index(0);
|
||||
|
||||
const int START_ROW = 5;
|
||||
const int END_ROW = 504;
|
||||
|
||||
int rowCount{};
|
||||
for (const auto& row : ws.rows(false)) {
|
||||
if (rowCount < START_ROW) {
|
||||
++rowCount;
|
||||
for (auto row : ws.rows(true)) {
|
||||
// Skip the row if the first value is not a number (= seller no)
|
||||
if (row[0].data_type() != xlnt::cell::type::number) {
|
||||
continue;
|
||||
} else if (rowCount > END_ROW) {
|
||||
break;
|
||||
}
|
||||
|
||||
//Skip the row if the seller has neither a first name nor a surname
|
||||
if (row[2].value<std::string>().empty() && row[3].value<std::string>().empty()) {
|
||||
++rowCount;
|
||||
continue;
|
||||
}
|
||||
auto seller = std::make_unique<Seller>();
|
||||
|
@ -46,7 +40,6 @@ std::size_t ExcelReader::readSellersFromFile(const fs::path& filePath, Marketpla
|
|||
std::string lastName = row[3].value<std::string>();
|
||||
seller->setLastName(trim(lastName));
|
||||
market->getSellers().push_back(std::move(seller));
|
||||
rowCount++;
|
||||
}
|
||||
|
||||
// If there was no special seller "Sonderkonto" in import data, then create one
|
||||
|
|
Loading…
Reference in a new issue