diff --git a/apps/red-ui/src/app/models/file/file-data.model.ts b/apps/red-ui/src/app/models/file/file-data.model.ts index 8c5f7e34b..10ce0ec5c 100644 --- a/apps/red-ui/src/app/models/file/file-data.model.ts +++ b/apps/red-ui/src/app/models/file/file-data.model.ts @@ -1,4 +1,4 @@ -import { Dictionary, File, IRedactionLog, IRedactionLogEntry, IViewedPage, User, ViewMode } from '@red/domain'; +import { Dictionary, File, IRedactionLog, IRedactionLogEntry, IViewedPage, ViewMode } from '@red/domain'; import { AnnotationWrapper } from './annotation.wrapper'; import { RedactionLogEntryWrapper } from './redaction-log-entry.wrapper'; import * as moment from 'moment'; @@ -122,10 +122,10 @@ export class FileDataModel { private _isChangeLogEntry(redactionLogEntry: IRedactionLogEntry, wrapper: RedactionLogEntryWrapper) { if (this.file.numberOfAnalyses > 1) { - redactionLogEntry.changes.sort((a, b) => moment(a.dateTime).valueOf() - moment(b.dateTime).valueOf()); + var viableChanges = redactionLogEntry.changes.filter(c => c.analysisNumber > 1); + viableChanges.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 lastChange = viableChanges.length >= 1 ? viableChanges[viableChanges.length - 1] : undefined; const page = redactionLogEntry.positions?.[0].page; const viewedPage = this.viewedPages.filter(p => p.page === page).pop(); @@ -134,7 +134,7 @@ export class FileDataModel { 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); + const relevantChanges = viableChanges.filter(change => moment(change.dateTime).valueOf() > viewTime); // at least one unseen change if (relevantChanges.length > 0) { // at least 1 relevant change diff --git a/libs/red-domain/src/lib/redaction-log/change.ts b/libs/red-domain/src/lib/redaction-log/change.ts index 341b4cfb9..27b3ee0f4 100644 --- a/libs/red-domain/src/lib/redaction-log/change.ts +++ b/libs/red-domain/src/lib/redaction-log/change.ts @@ -1,5 +1,6 @@ export interface IChange { dateTime?: string; + analysisNumber?: number; type?: ChangeType; } diff --git a/libs/red-domain/src/lib/redaction-log/redaction-log.ts b/libs/red-domain/src/lib/redaction-log/redaction-log.ts index b5de4258e..9f7952929 100644 --- a/libs/red-domain/src/lib/redaction-log/redaction-log.ts +++ b/libs/red-domain/src/lib/redaction-log/redaction-log.ts @@ -3,6 +3,7 @@ import { IRedactionLogEntry } from './redaction-log-entry'; export interface IRedactionLog { analysisVersion?: number; + analysisNumber?: number; dictionaryVersion?: number; dossierDictionaryVersion?: number; legalBasis?: ILegalBasis[];