From f1d77a7eee48b322ba020e187548c88c120121be Mon Sep 17 00:00:00 2001 From: Gabriel Moreira Minossi Date: Sun, 17 Jan 2021 23:16:26 -0300 Subject: [PATCH] Adjusting `getMultiblockStatusUsecase` Returning status outside of a table Using `isWorkAllowed` instead of an unexistent method --- .../multiblock/get-multiblock-status-usecase.lua | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Programs/monitor-system/domain/multiblock/get-multiblock-status-usecase.lua b/Programs/monitor-system/domain/multiblock/get-multiblock-status-usecase.lua index c680f00..889c1ab 100755 --- a/Programs/monitor-system/domain/multiblock/get-multiblock-status-usecase.lua +++ b/Programs/monitor-system/domain/multiblock/get-multiblock-status-usecase.lua @@ -1,6 +1,5 @@ -- Import section Machine = require("data.datasource.machine") -Alarm = require("api.sound.alarm") -- local function exec(address, name) @@ -9,7 +8,7 @@ local function exec(address, name) local problems = multiblock:getNumberOfProblems() local state = {} - if multiblock:isMachineEnabled() then + if multiblock:isWorkAllowed() then if multiblock:hasWork() then state = Machine.states.ON else @@ -24,12 +23,10 @@ local function exec(address, name) end local totalProgress = multiblock:getProgress() - local maxProgress = totalProgress.maximum - local progress = totalProgress.current - status[multiblock.name] = { - progress = progress, - maxProgress = maxProgress, + status = { + progress = totalProgress.current, + maxProgress = totalProgress.maximum, problems = problems, probablyUses = multiblock:getEnergyUsage(), efficiencyPercentage = multiblock:getEfficiencyPercentage(),