LT-288: Fixing viewer crash for non associated studies
This commit is contained in:
1 parent
0eeb05e72b
commit
396f83b449
7 files changed
+88
-38
No files matched your search
@@ -26,8 +26,14 @@ class TimepointApi {
|
||||
});
|
||||
}
|
||||
|
||||
// Return the prior timepoint
|
||||
prior() {
|
||||
const latestDate = this.current().latestDate;
|
||||
const current = this.current();
|
||||
if (!current) {
|
||||
return;
|
||||
}
|
||||
|
||||
const latestDate = current.latestDate;
|
||||
return this.timepoints.findOne({
|
||||
latestDate: {
|
||||
$lt: latestDate
|
||||
@@ -41,9 +47,15 @@ class TimepointApi {
|
||||
|
||||
// Return only the current and prior Timepoints
|
||||
currentAndPrior() {
|
||||
let timepoints = [this.current()];
|
||||
const timepoints = [];
|
||||
|
||||
const current = this.current();
|
||||
if (current) {
|
||||
timepoints.push(current);
|
||||
}
|
||||
|
||||
const prior = this.prior();
|
||||
if (prior) {
|
||||
if (current && prior._id !== current._id) {
|
||||
timepoints.push(prior);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user