From a8d7be2e2e2bd9324dc0fb8a0bc0bc6b028181e7 Mon Sep 17 00:00:00 2001 From: Petar Toshev Date: Wed, 27 Dec 2023 10:33:46 +0200 Subject: [PATCH] Fix upgradeEndTime --- ikabot/function/islandWorkplaces.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ikabot/function/islandWorkplaces.py b/ikabot/function/islandWorkplaces.py index 60e96fbe..b26927ba 100644 --- a/ikabot/function/islandWorkplaces.py +++ b/ikabot/function/islandWorkplaces.py @@ -77,14 +77,18 @@ def extract_workplace_data(init_data, material_ind, json): """ view = get_view(material_ind) data = dict(init_data) + time_now = int(json[0][1]['time']) background_data = json[0][1]['backgroundData'] template_data = json[2][1] slider_data = template_data['js_ResourceSlider']['slider'] end_upgrade_time = int(background_data[view + 'EndUpgradeTime']) # resourceEndUpgradeTime / tradegoodEndUpgradeTime + upgrading = end_upgrade_time > 0 + if upgrading: + end_upgrade_time = daysHoursMinutes(int(end_upgrade_time) - time_now) data.update({ 'level': background_data[view + 'Level'], # resourceLevel / tradegoodLevel - 'upgradeEndTime': daysHoursMinutes(end_upgrade_time), - 'upgrading': end_upgrade_time > 0, + 'upgradeEndTime': end_upgrade_time, + 'upgrading': upgrading, 'material': material_ind, 'totalWorkers': template_data['valueWorkers'], 'freeCitizens': template_data['valueCitizens'],