num analysis set now

This commit is contained in:
Timo Bejan 2021-10-14 09:15:41 +03:00
parent fb7c03db3a
commit 1a1a62d48e

View File

@ -105,34 +105,36 @@ export class FileDataModel {
}
private _isChangeLogEntry(redactionLogEntry: RedactionLogEntry, wrapper: RedactionLogEntryWrapper) {
redactionLogEntry.changes.sort((a, b) => moment(a.dateTime).valueOf() - moment(b.dateTime).valueOf());
if (this.file.numberOfAnalyses > 0) {
redactionLogEntry.changes.sort((a, b) => moment(a.dateTime).valueOf() - moment(b.dateTime).valueOf());
const lastChange =
redactionLogEntry.changes.length >= 1 ? redactionLogEntry.changes[redactionLogEntry.changes.length - 1] : undefined;
const page = redactionLogEntry.positions?.[0].page;
const lastChange =
redactionLogEntry.changes.length >= 1 ? redactionLogEntry.changes[redactionLogEntry.changes.length - 1] : undefined;
const page = redactionLogEntry.positions?.[0].page;
const viewedPage = this.viewedPages.pages.filter(p => p.page === page).pop();
const viewedPage = this.viewedPages.pages.filter(p => p.page === page).pop();
// page has been seen -> let's see if it's a change
if (viewedPage) {
const viewTime = moment(viewedPage.viewedTime);
// these are all unseen changes
const relevantChanges = redactionLogEntry.changes.filter(change => moment(change.dateTime).valueOf() > viewTime.valueOf());
// at least one unseen change
if (relevantChanges.length > 0) {
wrapper.changeLogType = relevantChanges[relevantChanges.length - 1].type;
wrapper.isChangeLogEntry = true;
viewedPage.hasChanges = true;
this.hasChangeLog = true;
// page has been seen -> let's see if it's a change
if (viewedPage) {
const viewTime = moment(viewedPage.viewedTime).valueOf() - FileDataModel.DELTA_VIEW_TIME;
// these are all unseen changes
const relevantChanges = redactionLogEntry.changes.filter(change => moment(change.dateTime).valueOf() > viewTime);
// at least one unseen change
if (relevantChanges.length > 0) {
wrapper.changeLogType = relevantChanges[relevantChanges.length - 1].type;
wrapper.isChangeLogEntry = true;
viewedPage.hasChanges = true;
this.hasChangeLog = true;
} else {
// no relevant changes - hide removed anyway
wrapper.isChangeLogEntry = false;
wrapper.hidden = lastChange && lastChange.type === 'REMOVED';
}
} else {
// no relevant changes - hide removed anyway
// Page doesn't have a view-time
wrapper.isChangeLogEntry = false;
wrapper.hidden = lastChange && lastChange.type === 'REMOVED';
}
} else {
// Page doesn't have a view-time
wrapper.isChangeLogEntry = false;
wrapper.hidden = lastChange && lastChange.type === 'REMOVED';
}
// console.log(wrapper.changeLogType, wrapper.hidden, wrapper.isChangeLogEntry, wrapper.value, lastChange);
}