Move removeCollections.js to server folder from both and check patientId while setting null array to toolState data
This commit is contained in:
parent
ca30e22464
commit
e6fd2e60b0
@ -70,25 +70,31 @@ Template.viewerMain.helpers({
|
||||
|
||||
Template.viewerMain.events({
|
||||
'click button#clearTools': function(e, template) {
|
||||
var contentId = template.data.contentId;
|
||||
var patientId = template.data.studies[0].patientId;
|
||||
var toolTypes = ["lesion", "nonTarget"];
|
||||
var toolState = cornerstoneTools.globalImageIdSpecificToolStateManager.toolState;
|
||||
var toolStateKeys = Object.keys(toolState).slice(0);
|
||||
|
||||
toolStateKeys.forEach(function (imageId) {
|
||||
toolTypes.forEach(function (toolType) {
|
||||
toolState[imageId][toolType] = {
|
||||
data: []
|
||||
};
|
||||
if(toolState[imageId][toolType]) {
|
||||
if(toolState[imageId][toolType].data[0].patientId === patientId) {
|
||||
toolState[imageId][toolType] = {
|
||||
data: []
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// Update imageViewerViewport elements
|
||||
$(".imageViewerViewport").each(function(viewportIndex, element) {
|
||||
$("#"+contentId+" .imageViewerViewport").each(function(viewportIndex, element) {
|
||||
cornerstone.updateImage(element);
|
||||
});
|
||||
|
||||
// Remove patient's measurements
|
||||
var patientId = template.data.studies[0].patientId;
|
||||
Meteor.call('removeMeasurementsByPatientId', patientId);
|
||||
|
||||
}
|
||||
|
||||
@ -48,10 +48,10 @@ Package.onUse(function (api) {
|
||||
|
||||
// Server functions
|
||||
api.addFiles('server/collections.js', 'server');
|
||||
api.addFiles('server/removeCollections.js', ['server']);
|
||||
|
||||
// Both client and server functions
|
||||
api.addFiles('both/collections.js', ['client', 'server']);
|
||||
api.addFiles('both/removeCollections.js', ['client', 'server']);
|
||||
|
||||
|
||||
// Library functions
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
|
||||
Meteor.methods({
|
||||
"removeMeasurementsByPatientId": function(patientId) {
|
||||
Measurements.remove(
|
||||
{patientId: patientId},
|
||||
{multi: true}
|
||||
{patientId: patientId}
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user