Skip to content

Commit

Permalink
Revert "fix: communication.callsignVhf not set properly in baseDeltas…
Browse files Browse the repository at this point in the history
….json" (#1843)

This reverts commit 8fdca1a.
  • Loading branch information
tkurki authored Dec 8, 2024
1 parent 0bb173e commit 8c80e65
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
13 changes: 1 addition & 12 deletions src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,19 +332,8 @@ function getFullDefaults(app: ConfigApp) {
function setBaseDeltas(app: ConfigApp) {
const defaultsPath = getBaseDeltasPath(app)
try {
const de = app.config.baseDeltaEditor

de.load(defaultsPath)
app.config.baseDeltaEditor.load(defaultsPath)
debug(`Found default deltas at ${defaultsPath.toString()}`)

//fix old, incorrectly done callsignVhf
const communication = de.getSelfValue('communication')
if (communication) {
if (communication.callsignVhf) {
de.setSelfValue('communication.callsignVhf', communication.callsignVhf)
}
de.setSelfValue('communication', undefined)
}
} catch (e) {
if ((e as any)?.code === 'ENOENT') {
debug(`No default deltas found at ${defaultsPath.toString()}`)
Expand Down
7 changes: 4 additions & 3 deletions src/serverroutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,7 @@ module.exports = function (

app.get(`${SERVERROUTESPREFIX}/vessel`, (req: Request, res: Response) => {
const de = app.config.baseDeltaEditor
const communication = de.getSelfValue('communication')
const draft = de.getSelfValue('design.draft')
const length = de.getSelfValue('design.length')
const type = de.getSelfValue('design.aisShipType')
Expand All @@ -670,7 +671,7 @@ module.exports = function (
gpsFromBow: de.getSelfValue('sensors.gps.fromBow'),
gpsFromCenter: de.getSelfValue('sensors.gps.fromCenter'),
aisShipType: type && type.id,
callsignVhf: de.getSelfValue('communication.callsignVhf')
callsignVhf: communication && communication.callsignVhf
}

res.json(json)
Expand Down Expand Up @@ -811,9 +812,9 @@ module.exports = function (
: undefined
)
de.setSelfValue(
'communication.callsignVhf',
'communication',
!isUndefined(vessel.callsignVhf) && vessel.callsignVhf.length
? vessel.callsignVhf
? { callsignVhf: vessel.callsignVhf }
: undefined
)

Expand Down

0 comments on commit 8c80e65

Please sign in to comment.