LT-368: Disassociating previous baselines/follow-ups on new baseline association

This commit is contained in:
Bruno Alves de Faria 2016-11-21 08:34:30 -02:00
parent 47e149b648
commit 4a3b01a4f6

View File

@ -4,6 +4,7 @@ import { Blaze } from 'meteor/blaze';
import { Random } from 'meteor/random';
import { moment } from 'meteor/momentjs:moment';
import { OHIF } from 'meteor/ohif:core';
import { _ } from 'meteor/underscore';
Template.dialogStudyAssociation.onCreated(() => {
const instance = Template.instance();
@ -50,8 +51,11 @@ Template.dialogStudyAssociation.onCreated(() => {
const studiesKeys = Object.keys(studies);
// TODO: REMOVE - Temporary for RSNA
const patientId = studies[studiesKeys[0]][0].patientId;
Timepoints.remove({ patientId });
const hasBaseline = _.contains(studiesKeys, 'baseline');
if (hasBaseline) {
const patientId = studies[studiesKeys[0]][0].patientId;
Timepoints.remove({ patientId });
}
studiesKeys.forEach(timepointType => {
// Get the studies associated with this timepoint