Fix insert/update logic of the measurements store.

This commit is contained in:
Jonathan Bernard 2020-02-16 21:08:05 -06:00
parent 4cb5b8d814
commit 35a116abbb

View File

@ -54,7 +54,7 @@ export class MeasurementStoreModule extends VuexModule {
const newMeasurements = existing.slice();
const index = findIndex(existing, { id: measurement.id });
if (index > 0) { newMeasurements.push(measurement); }
if (index < 0) { newMeasurements.push(measurement); }
else { newMeasurements[index] = measurement; }
this.measurements = assign({}, this.measurements, { [measure.id]: newMeasurements });
}