mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-09 09:33:57 -07:00
Price tag feature: correctly select the lowest price of all physical sets
This commit is contained in:
parent
2dd5080294
commit
ee841970da
1 changed files with 10 additions and 2 deletions
|
|
@ -55,8 +55,16 @@ void PriceUpdater::downloadFinished()
|
|||
while (it.hasNext()) {
|
||||
QVariantMap map = it.next().toMap();
|
||||
QString name = map.value("name").toString().toLower();
|
||||
float price = map.value("average").toString().toFloat();
|
||||
cardsPrice.insert(name, price);
|
||||
float price = map.value("price").toString().toFloat();
|
||||
QString set = map.value("set_code").toString();
|
||||
|
||||
/**
|
||||
* Make sure Masters Edition (MED) isn't the set, as it doesn't
|
||||
* physically exist. Also check the price to see that the cheapest set
|
||||
* ends up as the final price.
|
||||
*/
|
||||
if (set != "MED" && (!cardsPrice.contains(name) || cardsPrice.value(name) > price))
|
||||
cardsPrice.insert(name, price);
|
||||
}
|
||||
|
||||
InnerDecklistNode *listRoot = deck->getRoot();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue