Fix lesion table ordering, new lesion numbering

This commit is contained in:
Erik Ziegler 2016-01-09 18:03:12 +01:00
parent e4547f121d
commit 8afcb1a1a9
2 changed files with 8 additions and 5 deletions

View File

@ -127,15 +127,17 @@ var LesionManager = (function() {
isTarget: isTarget isTarget: isTarget
}, { }, {
sort: {lesionNumber: 1} sort: {lesionNumber: 1}
}); }).fetch();
// If measurements exist, find the last lesion number // If measurements exist, find the last lesion number
// from the given timepoint // from the given timepoint
var lesionNumberCounter = 1; var lesionNumberCounter = 1;
// Search through Measurements to see which ones // Search through every Measurement to see which ones
// already have data for this Timepoint // already have data for this Timepoint, if we find one that
measurements.forEach(function(measurement) { // doesn't have data, we will stop there and use that as the
// current Measurement
measurements.every(function(measurement) {
// If this measurement has no data for this Timepoint, // If this measurement has no data for this Timepoint,
// use this as the current Measurement // use this as the current Measurement
if (!measurement.timepoints[timepointID]) { if (!measurement.timepoints[timepointID]) {
@ -144,6 +146,7 @@ var LesionManager = (function() {
} }
lesionNumberCounter++; lesionNumberCounter++;
return true;
}); });
return lesionNumberCounter; return lesionNumberCounter;
} }

View File

@ -2,7 +2,7 @@ Template.lesionTable.helpers({
'measurement': function() { 'measurement': function() {
return Measurements.find({}, { return Measurements.find({}, {
sort: { sort: {
lesionNumber: 1 lesionNumberAbsolute: 1
} }
}); });
}, },