LT-242: Sharing same timepoints source among all the sub-templates that use it
This commit is contained in:
1 parent
a7ca825755
commit
a4354efa15
13 files changed
+156
-98
No files matched your search
+13
-15
@@ -8,24 +8,22 @@
|
||||
<div class="p-l-1">
|
||||
{{#if timepointList.length}}
|
||||
{{#each timepoint in timepointList}}
|
||||
{{#if shallShowTimepoint timepoint @index}}
|
||||
<div class="timepointEntry p-y-2">
|
||||
<div class="timepointHeader">
|
||||
<div class="timepointDetails clearfix">
|
||||
<div class="timepointFollowupTitle pull-left">
|
||||
{{timepointTitle timepoint timepoints.count @index}}
|
||||
</div>
|
||||
<div class="expandIcon pull-right">
|
||||
<i class="fa fa-chevron-down"></i>
|
||||
</div>
|
||||
<div class="timepointDate pull-right m-r-1">{{formatDA timepoint.earliestDate 'D-MMM-YYYY'}}</div>
|
||||
<div class="timepointEntry p-y-2">
|
||||
<div class="timepointHeader">
|
||||
<div class="timepointDetails clearfix">
|
||||
<div class="timepointFollowupTitle pull-left">
|
||||
{{timepointApi.title timepoint}}
|
||||
</div>
|
||||
<div class="timepointModalities">{{modalitiesSummary timepoint}}</div>
|
||||
<div class="expandIcon pull-right">
|
||||
<i class="fa fa-chevron-down"></i>
|
||||
</div>
|
||||
<div class="timepointDate pull-right m-r-1">{{formatDA timepoint.earliestDate 'D-MMM-YYYY'}}</div>
|
||||
</div>
|
||||
{{>studyTimepoint studies=(studies timepoint) index=@index viewportIndex=this.viewportIndex currentStudy=this.currentStudy}}
|
||||
<div class="timepointModalities">{{modalitiesSummary timepoint}}</div>
|
||||
</div>
|
||||
<hr>
|
||||
{{/if}}
|
||||
{{>studyTimepoint studies=(studies timepoint) index=@index viewportIndex=this.viewportIndex currentStudy=this.currentStudy}}
|
||||
</div>
|
||||
<hr>
|
||||
{{/each}}
|
||||
{{#if and this.currentStudy (not showAdditionalTimepoints)}}
|
||||
<div class="studyModality additional">
|
||||
|
||||
+14
-45
@@ -116,21 +116,22 @@ Template.studyTimepointBrowser.helpers({
|
||||
const instance = Template.instance();
|
||||
// Get the current study
|
||||
const currentStudy = instance.getCurrentStudy();
|
||||
// Build the query
|
||||
const query = {};
|
||||
// Declare the timepoints
|
||||
let timepoints;
|
||||
if (currentStudy && !instance.showAdditionalTimepoints.get()) {
|
||||
query['studyInstanceUids'] = {
|
||||
$in: [currentStudy.studyInstanceUid]
|
||||
};
|
||||
}
|
||||
// Sort timepoints based on timeline and type
|
||||
const sort = {
|
||||
sort: {
|
||||
latestDate: 1
|
||||
// Show only the current study's timepoint
|
||||
timepoints = instance.data.timepointApi.study(currentStudy.studyInstanceUid);
|
||||
} else {
|
||||
if (instance.timepointViewType.get() === 'all') {
|
||||
// Show all timepoints
|
||||
timepoints = instance.data.timepointApi.all();
|
||||
} else {
|
||||
// Show only key timepoints
|
||||
timepoints = instance.data.timepointApi.key();
|
||||
}
|
||||
};
|
||||
// Returns all timepoints with sorting
|
||||
return Timepoints.find(query, sort).fetch().reverse();
|
||||
}
|
||||
// Returns the timepoints
|
||||
return timepoints;
|
||||
},
|
||||
|
||||
// Get the studies for a specific timepoint
|
||||
@@ -138,38 +139,6 @@ Template.studyTimepointBrowser.helpers({
|
||||
return Template.instance().getStudies(timepoint);
|
||||
},
|
||||
|
||||
// Decides if a timepoint shall be shown or omitted
|
||||
shallShowTimepoint(timepoint, index) {
|
||||
const instance = Template.instance();
|
||||
|
||||
// Show all timepoints when view type is all
|
||||
if (instance.timepointViewType.get() === 'all') {
|
||||
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';
|
||||
},
|
||||
|
||||
// Build the timepoint title based on its date
|
||||
timepointTitle(timepoint, total, index) {
|
||||
const timepointName = getTimepointName(timepoint);
|
||||
|
||||
const states = {
|
||||
0: '(Current)',
|
||||
1: '(Prior)'
|
||||
};
|
||||
// TODO: [design] find out how to define the nadir timepoint
|
||||
const parenthesis = states[index] || '';
|
||||
return `${timepointName} ${parenthesis}`;
|
||||
},
|
||||
|
||||
// Build the modalities summary for all timepoint's studies
|
||||
modalitiesSummary(timepoint) {
|
||||
const instance = Template.instance();
|
||||
|
||||
Reference in new issue
Block a user