Removing the need for schema/collection on temp tools when deleting it
This commit is contained in:
parent
861931b329
commit
3a36c89fd4
@ -10,7 +10,7 @@ class MeasurementHandlers {
|
|||||||
const measurementData = eventData.measurementData;
|
const measurementData = eventData.measurementData;
|
||||||
const Collection = measurementApi.tools[eventData.toolType];
|
const Collection = measurementApi.tools[eventData.toolType];
|
||||||
|
|
||||||
// Stop here if the tool data shall not be stored (e.g. temp tools)
|
// Stop here if the tool data shall not be persisted (e.g. temp tools)
|
||||||
if (!Collection) {
|
if (!Collection) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -79,7 +79,7 @@ class MeasurementHandlers {
|
|||||||
const measurementData = eventData.measurementData;
|
const measurementData = eventData.measurementData;
|
||||||
const Collection = measurementApi.tools[eventData.toolType];
|
const Collection = measurementApi.tools[eventData.toolType];
|
||||||
|
|
||||||
// Stop here if the tool data shall not be stored (e.g. temp tools)
|
// Stop here if the tool data shall not be persisted (e.g. temp tools)
|
||||||
if (!Collection) {
|
if (!Collection) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -121,9 +121,15 @@ class MeasurementHandlers {
|
|||||||
const measurementData = eventData.measurementData;
|
const measurementData = eventData.measurementData;
|
||||||
const measurementNumber = measurementData.measurementNumber;
|
const measurementNumber = measurementData.measurementNumber;
|
||||||
const { measurementApi, timepointApi } = instance.data;
|
const { measurementApi, timepointApi } = instance.data;
|
||||||
const collection = measurementApi.tools[eventData.toolType];
|
const Collection = measurementApi.tools[eventData.toolType];
|
||||||
|
|
||||||
|
// Stop here if the tool data shall not be persisted (e.g. temp tools)
|
||||||
|
if (!Collection) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const measurementTypeId = measurementApi.toolsGroupsMap[measurementData.toolType];
|
const measurementTypeId = measurementApi.toolsGroupsMap[measurementData.toolType];
|
||||||
const measurement = collection.findOne(measurementData._id);
|
const measurement = Collection.findOne(measurementData._id);
|
||||||
const timepointId = measurement.timepointId;
|
const timepointId = measurement.timepointId;
|
||||||
|
|
||||||
// Remove all the measurements with the given type and number
|
// Remove all the measurements with the given type and number
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user