Skip to content

Commit

Permalink
avoid mission recipe overwriting by yml file
Browse files Browse the repository at this point in the history
  • Loading branch information
cviolbarbosa committed May 23, 2024
1 parent 822af22 commit f50aefb
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions helyos_server/src/modules/read_config_yml.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const fs = require('fs');
const yaml = require('js-yaml');
const { logData } = require('./systemlog.js');
const lookup = require('./utils.js').lookup;
const OVERWRITE_MISSIONS = false


/**
Expand Down Expand Up @@ -67,8 +68,11 @@ const registerMissions = (missionsYmlPath) => {
if (oldWprocesses.length === 0) {
return databaseServices.work_process_type.insert(wprocess);
} else {
const wprocId = oldWprocesses[0].id;
return databaseServices.work_process_type.update_byId(wprocId, wprocess).then(() => wprocId);
if (OVERWRITE_MISSIONS) {
const wprocId = oldWprocesses[0].id;
return databaseServices.work_process_type.update_byId(wprocId, wprocess).then(() => wprocId);
}
return Promise.resolve(null)
}
})
// update the mission recipe of the work process
Expand Down Expand Up @@ -105,6 +109,10 @@ const saveWorkProcessServicePlans = (
jsonObj
) => {

if (workProcessTypeId === null){
return Promise.resolve([]);
}

// define a mapping object from yml keys to database column names
const ymlToWorkProcessServicePlanTableMap = {
work_process_type_id: "work_process_type_id",
Expand Down Expand Up @@ -246,6 +254,7 @@ const flattenServicesData = (jsonObj) => {
context: {
all_agents_data: "require_agents_data",
mission_agents_data: "require_mission_agents_data",
require_map_objects: "require_map_objects",
map_data: "require_map_data"
}
};
Expand Down

0 comments on commit f50aefb

Please sign in to comment.