WAM failed when added employee work unit count is less than available

This commit is contained in:
Eriks K
2020-05-15 09:26:10 +03:00
parent c216d98287
commit 6642839af5
2 changed files with 7 additions and 3 deletions

View File

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

View File

@ -838,8 +838,12 @@ class CitizenCompanies(BaseCitizen):
if not self.details.current_region == wam_holding['region_id']:
self.write_log("Unable to work as manager because of location - please travel!")
return
response = self._post_economy_work("production", wam=wam_list,
employ=self.my_companies.get_employable_factories()).json()
employ_factories = self.my_companies.get_employable_factories()
if sum(employ_factories.values()) > self.my_companies.work_units:
employ_factories = {}
response = self._post_economy_work("production", wam=wam_list, employ=employ_factories).json()
return response
def update_companies(self):