LT-292: Fixing wrong current and prior titles

This commit is contained in:
Bruno Alves de Faria 2016-11-16 11:16:06 -02:00
parent 77e75fe4d9
commit 8044898432

View File

@ -62,7 +62,7 @@ class TimepointApi {
disassociateStudy(timepointIds, studyInstanceUid) { disassociateStudy(timepointIds, studyInstanceUid) {
const disassociateFn = configuration.dataExchange.disassociate; const disassociateFn = configuration.dataExchange.disassociate;
disassociateFn(timepointIds, studyInstanceUid).then(() => { disassociateFn(timepointIds, studyInstanceUid).then(() => {
OHIF.log.info('Disassociation completed') OHIF.log.info('Disassociation completed');
this.timepoints.remove({}); this.timepoints.remove({});
this.retrieveTimepoints(); this.retrieveTimepoints();
@ -253,11 +253,24 @@ class TimepointApi {
const all = _.clone(this.all()).reverse(); const all = _.clone(this.all()).reverse();
let index = -1; let index = -1;
_.each(all, (currentTimepoint, currentIndex) => { let currentIndex = null;
if (currentTimepoint.timepointId === timepoint.timepointId) { for (let i = 0; i < all.length; i++) {
index = currentIndex; const currentTimepoint = all[i];
// Skip the iterations until we can't find the selected timepoint on study list
if (this.currentTimepointId === currentTimepoint.timepointId) {
currentIndex = 0;
} }
});
if (_.isNumber(currentIndex)) {
index = currentIndex++;
}
// Break the loop if reached the timepoint to get the title
if (currentTimepoint.timepointId === timepoint.timepointId) {
break;
}
}
const states = { const states = {
0: '(Current)', 0: '(Current)',