Skip to content

Commit 82e6647

Browse files
author
Moussa Iskounene
committed
review(parse): simplify unique_name parsing for StopCluster
1 parent 47510ba commit 82e6647

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/classes/groundplaces.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,11 @@ export class GroundPlacesController {
245245
type: GroundPlaceType.CLUSTER,
246246
});
247247

248-
const newStopCluster: GroundPlace = parseGeneratePlaceToGroundPlace(stopClusterCreated);
248+
const newStopCluster: GroundPlace = parseGeneratePlaceToGroundPlace({
249+
...stopClusterCreated,
250+
// Create `unique_name` attribute set to `null` only for StopCluster
251+
unique_name: null,
252+
});
249253

250254
this.storageService.addPlace(newStopCluster);
251255

src/helpers/parse.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { GroundPlaceServiced, GenerateGpuidGroundPlace, GroundPlace, GroundPlaceType } from '../types';
1+
import { GroundPlaceServiced, GenerateGpuidGroundPlace, GroundPlace } from '../types';
22
import { removeUndefinedValues } from './sanitize';
33

44
/**
@@ -17,8 +17,7 @@ const parseGeneratePlaceToGroundPlace = (generateGpuidGroundPlace: GenerateGpuid
1717
type: generateGpuidGroundPlace.type,
1818
childs: [],
1919
serviced: GroundPlaceServiced.FALSE,
20-
// Create `unique_name` attribute set to `null` only for StopCluster
21-
...(generateGpuidGroundPlace.type === GroundPlaceType.CLUSTER ? { unique_name: null } : {}),
20+
unique_name: generateGpuidGroundPlace.unique_name,
2221
};
2322

2423
removeUndefinedValues(newGroundPlace);

0 commit comments

Comments
 (0)