mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-10 04:16:43 -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()) {
|
while (it.hasNext()) {
|
||||||
QVariantMap map = it.next().toMap();
|
QVariantMap map = it.next().toMap();
|
||||||
QString name = map.value("name").toString().toLower();
|
QString name = map.value("name").toString().toLower();
|
||||||
float price = map.value("average").toString().toFloat();
|
float price = map.value("price").toString().toFloat();
|
||||||
cardsPrice.insert(name, price);
|
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();
|
InnerDecklistNode *listRoot = deck->getRoot();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue