feat(kæde): flows kan tilhøre en kæde
This commit is contained in:
@@ -97,6 +97,7 @@ local function copyRun(run)
|
||||
vehicleIds = copyList(run.vehicleIds),
|
||||
stopped = run.stopped == true,
|
||||
wagons = ADRuns.copyWagons(run.wagons),
|
||||
chain = run.chain or "",
|
||||
}
|
||||
end
|
||||
|
||||
@@ -145,6 +146,7 @@ function ADRuns.createRun(store, name, kind)
|
||||
loops = 0,
|
||||
returnBelowPercent = ADRuns.DEFAULT_RETURN_BELOW_PERCENT,
|
||||
vehicleIds = {},
|
||||
chain = "",
|
||||
}
|
||||
new.nextId = new.nextId + 1
|
||||
table.insert(new.runs, run)
|
||||
@@ -204,6 +206,7 @@ function ADRuns.updateRun(store, runId, changes)
|
||||
if changes.storeAbovePercent ~= nil then run.storeAbovePercent = clampRange(changes.storeAbovePercent, ADRuns.DEFAULT_STORE_ABOVE_PERCENT, ADRuns.MIN_STORE_ABOVE_PERCENT, ADRuns.MAX_STORE_ABOVE_PERCENT) end
|
||||
if changes.sellAbovePercent ~= nil then run.sellAbovePercent = clampRange(changes.sellAbovePercent, ADRuns.DEFAULT_SELL_ABOVE_PERCENT, ADRuns.MIN_SELL_ABOVE_PERCENT, ADRuns.MAX_SELL_ABOVE_PERCENT) end
|
||||
if changes.collectRound ~= nil then run.collectRound = changes.collectRound == true end
|
||||
if changes.chain ~= nil then run.chain = tostring(changes.chain) end
|
||||
return new
|
||||
end
|
||||
|
||||
@@ -440,6 +443,7 @@ function ADRuns.toRecords(store)
|
||||
collectRound = run.collectRound and 1 or 0,
|
||||
stopped = run.stopped and 1 or 0,
|
||||
wagons = ADRuns.serializeWagons(run.wagons),
|
||||
chain = run.chain or "",
|
||||
}
|
||||
end
|
||||
return records
|
||||
@@ -494,6 +498,7 @@ function ADRuns.fromRecords(records)
|
||||
vehicleIds = copyList(record.vehicleIds),
|
||||
stopped = tonumber(record.stopped) == 1,
|
||||
wagons = ADRuns.parseWagons(record.wagons),
|
||||
chain = record.chain or "",
|
||||
})
|
||||
store.nextId = math.max(store.nextId, id + 1)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user