LT-247: Fixing follow-up names

This commit is contained in:
Bruno Alves de Faria 2016-06-16 14:55:07 -03:00 committed by Erik Ziegler
parent 37d67f491d
commit b6cb2051b8

View File

@ -17,7 +17,7 @@ Template.studyTimepointBrowser.onCreated(() => {
var notYetLoaded = Studies.findOne(query); var notYetLoaded = Studies.findOne(query);
if (!notYetLoaded) { if (!notYetLoaded) {
throw "No study data available for Study: " + studyInstanceUid; throw 'No study data available for Study: ' + studyInstanceUid;
} }
return notYetLoaded; return notYetLoaded;
@ -57,12 +57,11 @@ Template.studyTimepointBrowser.helpers({
// Sort timepoints based on timeline and type // Sort timepoints based on timeline and type
const sort = { const sort = {
sort: { sort: {
earliestDate: -1, latestDate: 1
timepointType: -1
} }
}; };
// Returns all timepoints with sorting // Returns all timepoints with sorting
return Timepoints.find({}, sort); return Timepoints.find({}, sort).fetch().reverse();
}, },
// Get the studies for a specific timepoint // Get the studies for a specific timepoint
studies(timepoint) { studies(timepoint) {
@ -82,19 +81,15 @@ Template.studyTimepointBrowser.helpers({
}, },
// Build the timepoint title based on its date // Build the timepoint title based on its date
timepointTitle(timepoint, total, index) { timepointTitle(timepoint, total, index) {
if (timepoint.timepointType === 'baseline') { const timepointName = getTimepointName(timepoint);
return 'Baseline';
}
const states = { const states = {
0: '(Current)', 0: '(Current)',
1: '(Prior)', 1: '(Prior)'
2: '(Nadir)'
}; };
// TODO: [design] find out how to define the nadir timepoint // TODO: [design] find out how to define the nadir timepoint
const followUp = total - index - 1;
const parenthesis = states[index] || ''; const parenthesis = states[index] || '';
return `Follow-up ${followUp} ${parenthesis}`; return `${timepointName} ${parenthesis}`;
}, },
// Build the modalities summary for all timepoint's studies // Build the modalities summary for all timepoint's studies
modalitiesSummary(timepoint) { modalitiesSummary(timepoint) {