mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 20:20:06 +00:00
Fix Level 3 Products Widget product selection status
This commit is contained in:
parent
4325f352b1
commit
14545fd83a
3 changed files with 22 additions and 7 deletions
|
|
@ -256,7 +256,7 @@ void Level3ProductsWidget::UpdateProductSelection(
|
|||
if (group == common::RadarProductGroup::Level3)
|
||||
{
|
||||
common::Level3ProductCategory category =
|
||||
common::GetLevel3CategoryByProduct(productName);
|
||||
common::GetLevel3CategoryByAwipsId(productName);
|
||||
p->UpdateProductSelection(category);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -73,7 +73,9 @@ const std::string&
|
|||
GetLevel3CategoryDefaultProduct(Level3ProductCategory category);
|
||||
Level3ProductCategory GetLevel3Category(const std::string& categoryName);
|
||||
Level3ProductCategory
|
||||
GetLevel3CategoryByProduct(const std::string& productName);
|
||||
GetLevel3CategoryByProduct(const std::string& productName);
|
||||
Level3ProductCategory
|
||||
GetLevel3CategoryByAwipsId(const std::string& awipsId);
|
||||
const std::string& GetLevel3Palette(int16_t productCode);
|
||||
|
||||
std::string GetLevel3ProductByAwipsId(const std::string& awipsId);
|
||||
|
|
|
|||
|
|
@ -266,12 +266,18 @@ Level3ProductCategory GetLevel3Category(const std::string& categoryName)
|
|||
Level3ProductCategory GetLevel3CategoryByProduct(const std::string& productName)
|
||||
{
|
||||
auto result = std::find_if(
|
||||
level3CategoryDefaultAwipsId_.cbegin(),
|
||||
level3CategoryDefaultAwipsId_.cend(),
|
||||
[&](const std::pair<Level3ProductCategory, std::string>& pair) -> bool
|
||||
{ return pair.second == productName; });
|
||||
level3CategoryProductList_.cbegin(),
|
||||
level3CategoryProductList_.cend(),
|
||||
[&](
|
||||
const std::pair<Level3ProductCategory, std::vector<std::string>>& pair)
|
||||
-> bool
|
||||
{
|
||||
return std::find(pair.second.cbegin(),
|
||||
pair.second.cend(),
|
||||
productName) != pair.second.cend();
|
||||
});
|
||||
|
||||
if (result != level3CategoryDefaultAwipsId_.cend())
|
||||
if (result != level3CategoryProductList_.cend())
|
||||
{
|
||||
return result->first;
|
||||
}
|
||||
|
|
@ -281,6 +287,13 @@ Level3ProductCategory GetLevel3CategoryByProduct(const std::string& productName)
|
|||
}
|
||||
}
|
||||
|
||||
Level3ProductCategory GetLevel3CategoryByAwipsId(const std::string& awipsId)
|
||||
{
|
||||
std::string productName = GetLevel3ProductByAwipsId(awipsId);
|
||||
|
||||
return GetLevel3CategoryByProduct(productName);
|
||||
}
|
||||
|
||||
const std::string& GetLevel3Palette(int16_t productCode)
|
||||
{
|
||||
auto it = level3Palette_.find(productCode);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue