Skip to content

Commit cf5b8ec

Browse files
committed
fix processor error
1 parent ef3c8ef commit cf5b8ec

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

plugins/arcgis/service/src/FeatureLayerProcessor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ export class FeatureLayerProcessor {
108108

109109
const bins = new ObservationBins();
110110

111-
for (const arcObservation of observations.observations) {
111+
for (const arcObservation of arcObjectsForLayer.observations) {
112112
// TODO: Would probably want a better way to determine which observations need to be updated in arcgis
113-
if (observations.firstRun || arcObservation.lastModified !== arcObservation.createdAt) {
113+
if (arcObjectsForLayer.firstRun || arcObservation.lastModified !== arcObservation.createdAt) {
114114
bins.updates.add(arcObservation);
115115
} else if (!this._addedObs.has(arcObservation.id)) {
116116
bins.adds.add(arcObservation);

plugins/arcgis/service/src/ObservationProcessor.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -354,19 +354,17 @@ export class ObservationProcessor {
354354
const arcObjects = new ArcObjects();
355355
this._geometryChangeHandler.checkForGeometryChange(observations, arcObjects, layerProcessors, this._firstRun);
356356
for (const observation of observations) {
357-
if (observation.states.length > 0) {
358-
// Should archived observations be deleted after a period of time?
359-
if (observation.states[0].name === 'archived') {
360-
const arcObservation = this._transformer.createObservation(observation);
361-
arcObjects.deletions.push(arcObservation);
362-
} else {
363-
let user = null;
364-
if (observation.userId != null) {
365-
user = await this._userRepo.findById(observation.userId);
366-
}
367-
const arcObservation = this._transformer.transform(observation, eventTransform, user);
368-
arcObjects.add(arcObservation);
357+
// TODO: Should archived observations be removed after a certain time? Also this uses 'startsWith' because not all deleted observations use 'archived' which is a bug
358+
if (observation.states.length > 0 && observation.states[0].name.startsWith('archive')) {
359+
const arcObservation = this._transformer.createObservation(observation);
360+
arcObjects.deletions.push(arcObservation);
361+
} else {
362+
let user = null;
363+
if (observation.userId != null) {
364+
user = await this._userRepo.findById(observation.userId);
369365
}
366+
const arcObservation = this._transformer.transform(observation, eventTransform, user);
367+
arcObjects.add(arcObservation);
370368
}
371369
}
372370
arcObjects.firstRun = this._firstRun;

0 commit comments

Comments
 (0)