From c2dfb0e7bae33a8ebac992c07e0d86c41e1f322e Mon Sep 17 00:00:00 2001 From: Bruno Alves de Faria Date: Fri, 17 Jun 2016 08:44:47 -0300 Subject: [PATCH] LT-251: Showing the timepoint for the current study even if it's not a key timepoint --- .../studyTimepointBrowser/studyTimepointBrowser.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Packages/lesiontracker/client/components/studyTimepointBrowser/studyTimepointBrowser.js b/Packages/lesiontracker/client/components/studyTimepointBrowser/studyTimepointBrowser.js index 314e8be05..2883acf38 100644 --- a/Packages/lesiontracker/client/components/studyTimepointBrowser/studyTimepointBrowser.js +++ b/Packages/lesiontracker/client/components/studyTimepointBrowser/studyTimepointBrowser.js @@ -4,6 +4,11 @@ Template.studyTimepointBrowser.onCreated(() => { // Defines whether to show all key timepoints or only the current one instance.showAdditionalTimepoints = new ReactiveVar(true); + // Return the current study if it's defined + instance.getCurrentStudy = () => { + return instance.data.currentStudy && instance.data.currentStudy.get(); + }; + // Get the studies for a specific timepoint instance.getStudies = timepoint => { return timepoint.studyInstanceUids.map(studyInstanceUid => { @@ -83,7 +88,7 @@ Template.studyTimepointBrowser.helpers({ timepoints() { const instance = Template.instance(); // Get the current study - const currentStudy = instance.data.currentStudy && instance.data.currentStudy.get(); + const currentStudy = instance.getCurrentStudy(); // Build the query const query = {}; if (currentStudy && !instance.showAdditionalTimepoints.get()) { @@ -115,6 +120,12 @@ Template.studyTimepointBrowser.helpers({ return true; } + // Always Show the timepoint for current study + const currentStudy = instance.getCurrentStudy(); + if (currentStudy && _.contains(timepoint.studyInstanceUids, currentStudy.studyInstanceUid)) { + return true; + } + // Show only the latest timepoints and baseline return index < 3 || timepoint.timepointType === 'baseline'; },