From bb48fa6ea25670db51186a13513129b84fd2ba7f Mon Sep 17 00:00:00 2001 From: Bruno Alves de Faria Date: Fri, 23 Jun 2017 12:51:02 -0300 Subject: [PATCH] Adding support for Locked Time Points in Web Viewer --- .../both/schema/timepoints.js | 4 ++++ .../components/caseProgress/caseProgress.js | 18 ++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Packages/ohif-measurements/both/schema/timepoints.js b/Packages/ohif-measurements/both/schema/timepoints.js index 3b52c5064..41ea0f233 100644 --- a/Packages/ohif-measurements/both/schema/timepoints.js +++ b/Packages/ohif-measurements/both/schema/timepoints.js @@ -15,6 +15,10 @@ export const schema = new SimpleSchema({ allowedValues: ['baseline', 'followup'], defaultValue: 'baseline', }, + isLocked: { + type: Boolean, + label: 'Timepoint Locked' + }, studyInstanceUids: { type: [String], label: 'Study Instance Uids', diff --git a/Packages/ohif-measurements/client/components/caseProgress/caseProgress.js b/Packages/ohif-measurements/client/components/caseProgress/caseProgress.js index f557d7de2..f39e19f44 100644 --- a/Packages/ohif-measurements/client/components/caseProgress/caseProgress.js +++ b/Packages/ohif-measurements/client/components/caseProgress/caseProgress.js @@ -9,7 +9,7 @@ Template.caseProgress.onCreated(() => { instance.progressPercent = new ReactiveVar(); instance.progressText = new ReactiveVar(); - instance.isLocked = new ReactiveVar(); + instance.isLocked = new ReactiveVar(false); instance.path = 'viewer.studyViewer.measurements'; instance.saveObserver = new Tracker.Dependency(); @@ -62,15 +62,21 @@ Template.caseProgress.onRendered(() => { return; } - // Get the current timepoint + // Get the current and prior timepoints const current = timepointApi.current(); const prior = timepointApi.prior(); - if (!current || !prior || !current.timepointId) { - instance.progressPercent.set(100); - return; + + // Stop here if timepoint is locked + if (current && current.isLocked) { + return instance.isLocked.set(true); + } else { + instance.isLocked.set(false); } - instance.isLocked.set(current.isLocked); + // Stop here if no current or prior timepoint was found + if (!current || !prior || !current.timepointId) { + return instance.progressPercent.set(100); + } // Retrieve the initial number of targets left to measure at this // follow-up. Note that this is done outside of the reactive function