Remove some subscription / reactivity / caching bugs and the unnecessary PatientLocations collection

This commit is contained in:
Erik Ziegler committed 2016-02-10 16:38:49 +01:00
1 parent 7d42456f57
commit 9cde04bcfe
43 files changed
+321 -234

No files matched your search

+5 -3
View File
@@ -1,16 +1,18 @@
<template name="viewer">
{{#if Template.subscriptionsReady}}
<div id="viewer">
{{>confirmDeleteDialog}}
{{>lesionLocationDialog}}
{{>nonTargetLesionDialog}}
{{>nonTargetResponseDialog}}
{{>timepointTextDialog}}
{{ >conformanceCheckFeedback }}
{{>conformanceCheckFeedback}}
{{>hidingPanel}}
<div id="viewportAndLesionTable">
{{>viewerMain }}
{{>lesionTable }}
</div>
</div>
{{else}}
{{>loadingText}}
{{/if}}
</template>
+19 -7
View File
@@ -1,9 +1,14 @@
Session.setDefault('activeViewport', false);
ViewerStudies = new Meteor.Collection(null);
ViewerStudies._debugName = 'ViewerStudies';
Template.viewer.onCreated(function() {
// Attach the Window resize listener
$(window).on('resize', handleResize);
ValidationErrors.remove({});
var self = this;
var firstMeasurementsActivated = false;
var contentId = this.data.contentId;
@@ -97,10 +102,11 @@ Template.viewer.onCreated(function() {
Session.set('activeViewport', ViewerData[contentId].activeViewport || false);
// Set lesion tool buttons as disabled if pixel spacing is not available for active element
this.autorun(pixelSpacingAutorunCheck);
self.autorun(pixelSpacingAutorunCheck);
// Update the ViewerStudies collection with the loaded studies
ViewerStudies = new Meteor.Collection(null);
ViewerStudies.remove({});
this.data.studies.forEach(function(study) {
study.selected = true;
ViewerStudies.insert(study);
@@ -110,11 +116,17 @@ Template.viewer.onCreated(function() {
Session.set('patientId', patientId);
self.autorun(function() {
var patientId = Session.get('patientId');
self.subscribe('singlePatientTimepoints', patientId);
self.subscribe('singlePatientMeasurements', patientId);
var dataContext = Template.currentData();
self.subscribe('singlePatientAssociatedStudies', dataContext.studies[0].patientId);
self.subscribe('singlePatientTimepoints', dataContext.studies[0].patientId);
self.subscribe('singlePatientMeasurements', dataContext.studies[0].patientId);
var subscriptionsReady = self.subscriptionsReady();
console.log('autorun viewer.js. Ready: ' + subscriptionsReady);
if (subscriptionsReady) {
TrialResponseCriteria.validateAllDelayed();
if (self.subscriptionsReady()) {
ViewerStudies.find().observe({
added: function(study) {
// Find the relevant timepoint given the newly added study
@@ -128,7 +140,7 @@ Template.viewer.onCreated(function() {
log.warn('Study added to Viewer has not been associated!');
return;
}
// Update the added document with its related timepointId
ViewerStudies.update(study._id, {
$set: {