From 5611fe571323bb7bd995702be6a4dd2ce265a496 Mon Sep 17 00:00:00 2001 From: Anton Vakhrushev Date: Tue, 19 May 2020 11:01:34 +0300 Subject: [PATCH] Fix queue time calculation --- src/VillageState.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/VillageState.ts b/src/VillageState.ts index df329fe..05de550 100644 --- a/src/VillageState.ts +++ b/src/VillageState.ts @@ -149,7 +149,7 @@ function createProductionQueueState( queue, isActive: tasks.length !== 0 || taskEndingTimestamp !== 0, currentTaskFinishTimestamp: taskEndingTimestamp, - currentTaskFinishSeconds: taskEndingTimestamp ? taskEndingTimestamp - timestamp() : 0, + currentTaskFinishSeconds: Math.max(taskEndingTimestamp ? taskEndingTimestamp - timestamp() : 0, 0), firstTask: calcResourceBalance(firstTaskResources, resources, performance), allTasks: calcResourceBalance(allTaskResources, resources, performance), taskCount: tasks.length,