Skip to content

Commit

Permalink
Fix upgradeEndTime
Browse files Browse the repository at this point in the history
  • Loading branch information
pecataToshev committed Dec 27, 2023
1 parent caaf809 commit a8d7be2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ikabot/function/islandWorkplaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down

0 comments on commit a8d7be2

Please sign in to comment.