refactor(marker): review-fund — død kodegren i klik-routing, eksplicit kursus-kilde-opslag

This commit is contained in:
2026-09-26 01:32:55 +02:00
parent 322f7b1c30
commit 7a073ae047
2 changed files with 2 additions and 3 deletions
+2 -1
View File
@@ -209,7 +209,8 @@ end
local function sourceCourse(adEnv, field, source) local function sourceCourse(adEnv, field, source)
local saved = coursesOf(field.id)[source] local saved = coursesOf(field.id)[source]
if saved ~= nil then return saved end if saved ~= nil then return saved end
local vehicleId = source == "rake" and field.rakeVehicleId or source == "harvester" and field.harvestVehicleId or field.mowVehicleId local vehicleIds = {mower = field.mowVehicleId, rake = field.rakeVehicleId, harvester = field.harvestVehicleId}
local vehicleId = vehicleIds[source]
if vehicleId == nil then return nil end if vehicleId == nil then return nil end
for _, vehicle in ipairs(ADRunsController.getFarmVehicles(adEnv)) do for _, vehicle in ipairs(ADRunsController.getFarmVehicles(adEnv)) do
if ADRunsController.getVehicleId(vehicle) == vehicleId then return ADCpBridge.getCourse(vehicle) end if ADRunsController.getVehicleId(vehicle) == vehicleId then return ADCpBridge.getCourse(vehicle) end
@@ -389,8 +389,6 @@ function SmartPickupFrame:onClickFieldRow(state, data)
return return
elseif data.kind == "fieldTarget" then elseif data.kind == "fieldTarget" then
ADFieldJobs.setTarget(id, data.values ~= nil and data.values[state] or "") ADFieldJobs.setTarget(id, data.values ~= nil and data.values[state] or "")
elseif id == nil then
return
elseif SmartPickupFrame.PLAN_CHOICES[data.kind] ~= nil then elseif SmartPickupFrame.PLAN_CHOICES[data.kind] ~= nil then
local value = data.values ~= nil and data.values[state] or nil local value = data.values ~= nil and data.values[state] or nil
if value ~= nil then ADFieldJobs.setPlan(id, {[SmartPickupFrame.PLAN_CHOICES[data.kind]] = value}) end if value ~= nil then ADFieldJobs.setPlan(id, {[SmartPickupFrame.PLAN_CHOICES[data.kind]] = value}) end