Fix a bug by sorting the studies by study date and time instead of only study date in prior function (to add prior indicator)
This commit is contained in:
parent
b0f9426015
commit
c511edd419
@ -135,6 +135,10 @@ function getImage(viewportIndex) {
|
|||||||
return enabledElement.image;
|
return enabledElement.image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatDateTime(date, time) {
|
||||||
|
return `${date} ${time}`;
|
||||||
|
}
|
||||||
|
|
||||||
Template.viewportOverlay.helpers({
|
Template.viewportOverlay.helpers({
|
||||||
wwwc: function() {
|
wwwc: function() {
|
||||||
Session.get('CornerstoneImageRendered' + this.viewportIndex);
|
Session.get('CornerstoneImageRendered' + this.viewportIndex);
|
||||||
@ -306,19 +310,18 @@ Template.viewportOverlay.helpers({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Make sure there are more than two studies loaded in the viewer
|
// Make sure there are more than two studies loaded in the viewer
|
||||||
//
|
var viewportStudies = ViewerStudies.find();
|
||||||
|
if (viewportStudies.count() < 2) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Here we sort the collection in ascending order by study date, so
|
// Here we sort the collection in ascending order by study date, so
|
||||||
// that we can obtain the oldest study as the first element of the array
|
// that we can obtain the oldest study as the first element of the array
|
||||||
//
|
//
|
||||||
// TODO= Find out if we should encode studyDate as a Date in the ViewerStudies Collection
|
// TODO= Find out if we should encode studyDate as a Date in the ViewerStudies Collection
|
||||||
var viewportStudies = ViewerStudies.find({}, {
|
var viewportStudiesArray = _.sortBy(viewportStudies.fetch(), function(study) {
|
||||||
sort: {
|
return formatDateTime(study.studyDate, study.studyTime);
|
||||||
studyDate: 1
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
if (viewportStudies.count() < 2) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get study data
|
// Get study data
|
||||||
var study = cornerstoneTools.metaData.get('study', this.imageId);
|
var study = cornerstoneTools.metaData.get('study', this.imageId);
|
||||||
@ -326,8 +329,8 @@ Template.viewportOverlay.helpers({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var oldestStudy = viewportStudies.fetch()[0];
|
var oldestStudy = viewportStudiesArray[0];
|
||||||
if ((study.studyDate + " " + study.studyTime) <= (oldestStudy.studyDate + " " + oldestStudy.studyTime)) {
|
if (formatDateTime(study.studyDate, study.studyTime) <= formatDateTime(oldestStudy.studyDate, oldestStudy.studyTime)) {
|
||||||
return 'Prior';
|
return 'Prior';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user