From 3a36c89fd470002783f10a14a37d41fba32c6a99 Mon Sep 17 00:00:00 2001 From: Bruno Alves de Faria Date: Tue, 5 Sep 2017 21:22:39 -0300 Subject: [PATCH] Removing the need for schema/collection on temp tools when deleting it --- .../client/lib/MeasurementHandlers.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Packages/ohif-measurements/client/lib/MeasurementHandlers.js b/Packages/ohif-measurements/client/lib/MeasurementHandlers.js index a8c4c076b..c2656cb14 100644 --- a/Packages/ohif-measurements/client/lib/MeasurementHandlers.js +++ b/Packages/ohif-measurements/client/lib/MeasurementHandlers.js @@ -10,7 +10,7 @@ class MeasurementHandlers { const measurementData = eventData.measurementData; 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) { return; } @@ -79,7 +79,7 @@ class MeasurementHandlers { const measurementData = eventData.measurementData; 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) { return; } @@ -121,9 +121,15 @@ class MeasurementHandlers { const measurementData = eventData.measurementData; const measurementNumber = measurementData.measurementNumber; 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 measurement = collection.findOne(measurementData._id); + const measurement = Collection.findOne(measurementData._id); const timepointId = measurement.timepointId; // Remove all the measurements with the given type and number