Wrong offer assignment, resulting in returned data of newest offers not cheapest

This commit is contained in:
Eriks K 2020-05-12 14:19:10 +03:00
parent 05964f6c58
commit 5c47b70ea6
2 changed files with 5 additions and 3 deletions

View File

@ -5,7 +5,7 @@
__author__ = """Eriks Karls""" __author__ = """Eriks Karls"""
__email__ = 'eriks@72.lv' __email__ = 'eriks@72.lv'
__version__ = '0.20.0' __version__ = '0.20.0'
__commit_id__ = "d95c472" __commit_id__ = "05964f6"
from erepublik import classes, utils from erepublik import classes, utils
from erepublik.citizen import Citizen from erepublik.citizen import Citizen

View File

@ -1054,8 +1054,10 @@ class CitizenEconomy(CitizenTravel):
if (obj.price > float(offer["priceWithTaxes"]) or ( if (obj.price > float(offer["priceWithTaxes"]) or (
obj.price == float(offer["priceWithTaxes"]) and obj.amount < int(offer["amount"]) obj.price == float(offer["priceWithTaxes"]) and obj.amount < int(offer["amount"])
)): )):
offers[f"q{q}"] = OfferItem(float(offer["priceWithTaxes"]), int(offer["country_id"]), offers[f"q{q}"] = obj = OfferItem(
int(offer["amount"]), int(offer["id"]), int(offer["citizen_id"])) float(offer["priceWithTaxes"]), int(offer["country_id"]), int(offer["amount"]),
int(offer["id"]), int(offer["citizen_id"])
)
self.write_log(f"Scraped market in {self.now - start_dt}!") self.write_log(f"Scraped market in {self.now - start_dt}!")
return offers return offers