LT-363: Fixes for removing association and retrieving only applicable timepoints / measurements for the open case
This commit is contained in:
1 parent
2895ce84b1
commit
c9e607a21c
5 files changed
+88
-35
No files matched your search
@@ -1,10 +1,10 @@
|
||||
import { measurementTools } from './measurementTools';
|
||||
|
||||
export const retrieveMeasurements = (filter) => {
|
||||
export const retrieveMeasurements = (patientId, timepointIds) => {
|
||||
console.log('retrieveMeasurements');
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
Meteor.call('retrieveMeasurements', filter, (error, response) => {
|
||||
Meteor.call('retrieveMeasurements', patientId, timepointIds, (error, response) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
@@ -36,11 +36,11 @@ export const storeMeasurements = (measurementData, timepointIds) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const retrieveTimepoints = (filter) => {
|
||||
export const retrieveTimepoints = (patientId) => {
|
||||
console.log('retrieveTimepoints');
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
Meteor.call('retrieveTimepoints', filter, (error, response) => {
|
||||
Meteor.call('retrieveTimepoints', patientId, (error, response) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
@@ -81,12 +81,12 @@ export const updateTimepoint = (timepointData, query) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const removeTimepoint = timepointData => {
|
||||
export const removeTimepoint = timepointId => {
|
||||
console.log('removeTimepoint');
|
||||
console.log(timepointData);
|
||||
console.log(timepointId);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
Meteor.call('removeTimepoint', timepointData, (error, response) => {
|
||||
Meteor.call('removeTimepoint', timepointId, (error, response) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
|
||||
@@ -79,10 +79,9 @@ Meteor.methods({
|
||||
});
|
||||
},
|
||||
|
||||
removeTimepoint(timepointData) {
|
||||
removeTimepoint(timepointId) {
|
||||
OHIF.log.info('Removing Timepoint from the Server');
|
||||
OHIF.log.info(JSON.stringify(timepointData, null, 2));
|
||||
Timepoints.remove(timepointData);
|
||||
Timepoints.remove({timepointId});
|
||||
},
|
||||
|
||||
updateTimepoint(timepointData, query) {
|
||||
@@ -92,9 +91,15 @@ Meteor.methods({
|
||||
Timepoints.update(timepointData, query);
|
||||
},
|
||||
|
||||
retrieveTimepoints(filter) {
|
||||
retrieveTimepoints(patientId) {
|
||||
OHIF.log.info('Retrieving Timepoints from the Server');
|
||||
return Timepoints.find(filter || {}).fetch();
|
||||
|
||||
const filter = {}
|
||||
if (patientId) {
|
||||
filter.patientId = patientId;
|
||||
};
|
||||
|
||||
return Timepoints.find(filter).fetch();
|
||||
},
|
||||
|
||||
storeMeasurements(measurementData, filter = {}) {
|
||||
@@ -115,13 +120,23 @@ Meteor.methods({
|
||||
});
|
||||
},
|
||||
|
||||
retrieveMeasurements(filter = {}) {
|
||||
retrieveMeasurements(patientId, timepointIds) {
|
||||
OHIF.log.info('Retrieving Measurements from the Server');
|
||||
let measurementData = {};
|
||||
|
||||
const filter = {}
|
||||
if (patientId) {
|
||||
filter.patientId = patientId;
|
||||
}
|
||||
|
||||
if (timepointIds) {
|
||||
filter.timepointId = {
|
||||
$in: timepointIds
|
||||
};
|
||||
}
|
||||
|
||||
measurementTools.forEach(tool => {
|
||||
measurementData[tool.id] = MeasurementCollections[tool.id].find(filter || {}).fetch();
|
||||
measurementData[tool.id] = MeasurementCollections[tool.id].find(filter).fetch();
|
||||
});
|
||||
|
||||
return measurementData;
|
||||
|
||||
Reference in new issue
Block a user