mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 08:00:06 +00:00
Update L3 product category selection to work better for tdwr
This commit is contained in:
parent
504cde0e8b
commit
6509fc7043
3 changed files with 38 additions and 6 deletions
|
|
@ -73,8 +73,9 @@ Level2Product GetLevel2Product(const std::string& name);
|
|||
|
||||
const std::string& GetLevel3CategoryName(Level3ProductCategory category);
|
||||
const std::string& GetLevel3CategoryDescription(Level3ProductCategory category);
|
||||
const std::string&
|
||||
GetLevel3CategoryDefaultProduct(Level3ProductCategory category);
|
||||
std::string
|
||||
GetLevel3CategoryDefaultProduct(Level3ProductCategory category,
|
||||
const Level3ProductCategoryMap& categoryMap);
|
||||
Level3ProductCategory GetLevel3Category(const std::string& categoryName);
|
||||
Level3ProductCategory
|
||||
GetLevel3CategoryByProduct(const std::string& productName);
|
||||
|
|
|
|||
|
|
@ -298,9 +298,27 @@ const std::string& GetLevel3CategoryDescription(Level3ProductCategory category)
|
|||
return level3CategoryDescription_.at(category);
|
||||
}
|
||||
|
||||
const std::string&
|
||||
GetLevel3CategoryDefaultProduct(Level3ProductCategory category)
|
||||
std::string
|
||||
GetLevel3CategoryDefaultProduct(Level3ProductCategory category,
|
||||
const Level3ProductCategoryMap& categoryMap)
|
||||
{
|
||||
const auto& productsIt = categoryMap.find(category);
|
||||
if (productsIt == categoryMap.cend())
|
||||
{
|
||||
return level3CategoryDefaultAwipsId_.at(category);
|
||||
}
|
||||
|
||||
const auto& productsSiteHas = productsIt->second;
|
||||
const auto& productList = level3CategoryProductList_.at(category);
|
||||
for (auto& product : productList)
|
||||
{
|
||||
const auto& tiltsIt = productsSiteHas.find(product);
|
||||
if (tiltsIt != productsSiteHas.cend() && tiltsIt->second.size() > 0)
|
||||
{
|
||||
return tiltsIt->second[0];
|
||||
}
|
||||
}
|
||||
|
||||
return level3CategoryDefaultAwipsId_.at(category);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue