bugfix
This commit is contained in:
parent
e766b3ff95
commit
c1ca54a1d1
2 changed files with 7 additions and 1 deletions
|
@ -31,11 +31,14 @@ int Marketplace::getNextSellerNo()
|
||||||
[](const std::unique_ptr<Seller>& a, const std::unique_ptr<Seller>& b) -> bool {
|
[](const std::unique_ptr<Seller>& a, const std::unique_ptr<Seller>& b) -> bool {
|
||||||
return a->getSellerNo() < b->getSellerNo();
|
return a->getSellerNo() < b->getSellerNo();
|
||||||
});
|
});
|
||||||
|
if (iter == sellers_.end())
|
||||||
|
return 1;
|
||||||
return (*iter)->getSellerNo() + 1;
|
return (*iter)->getSellerNo() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Marketplace::getNumSellersDelete()
|
int Marketplace::getNumSellersDelete()
|
||||||
{
|
{
|
||||||
int count = std::count_if(sellers_.begin(), sellers_.end(), [](const auto& a){return a->getState() == Seller::State::DELETE;});
|
int count = std::count_if(sellers_.begin(), sellers_.end(),
|
||||||
|
[](const auto& a) { return a->getState() == Seller::State::DELETE; });
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
|
@ -21,6 +21,9 @@ QVariant SellerModel::data(const QModelIndex& index, int role) const
|
||||||
if (role != Qt::DisplayRole)
|
if (role != Qt::DisplayRole)
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
|
if (marketplace_->getSellers().size() == 0)
|
||||||
|
return QVariant();
|
||||||
|
|
||||||
Seller* seller = marketplace_->getSellers().at(index.row()).get();
|
Seller* seller = marketplace_->getSellers().at(index.row()).get();
|
||||||
|
|
||||||
/* if (seller->getState() == Seller::State::DELETE)
|
/* if (seller->getState() == Seller::State::DELETE)
|
||||||
|
|
Loading…
Reference in a new issue