LT-251: Showing the timepoint for the current study even if it's not a key timepoint

This commit is contained in:
Bruno Alves de Faria 2016-06-17 08:44:47 -03:00 committed by Erik Ziegler
parent 4b307598e9
commit c2dfb0e7ba

View File

@ -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';
},