const queueData = await cityRepo.buildBuilding(building, amount, city);
- construction.trigger(queueData, { delay: queueData.due });
+ construction.trigger(queueData, { delay: queueData.due - Date.now() });
}, 'reload-construction-queue');
server.post<{
const acct = await accountRepo.validate(req.authInfo.accountId, req.authInfo.token);
const city = await cityRepo.getUsersCity(acct.id);
- const amount = parseInt(req.body.amount, 10);
+ const amount = parseInt(req.body.amount, 10) || 0;
+ console.log('request amount?!', amount);
if(amount < 1) {
throw new BadInputError('Please specify an amount > 0', ERROR_CODE.INVALID_AMOUNT);
}
}
const queueData = await cityRepo.train(unit, amount, city);
- unitTraining.trigger(queueData, { delay: queueData.due });
+ unitTraining.trigger(queueData, { delay: queueData.due - Date.now() });
}, 'reload-unit-training');