From e5a27205d339c6306f05ee63bd06f32a66a8f1ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Ho=CC=88=C3=9Fl?= Date: Sun, 14 Jul 2019 08:43:19 +0200 Subject: [PATCH] Bugfix: missing text in PDF-exported diff view --- .../motions/motion-repository.service.ts | 61 +++++++++---------- .../motions/services/motion-pdf.service.ts | 1 - 2 files changed, 30 insertions(+), 32 deletions(-) diff --git a/client/src/app/core/repositories/motions/motion-repository.service.ts b/client/src/app/core/repositories/motions/motion-repository.service.ts index 909d30128..186fac8ac 100644 --- a/client/src/app/core/repositories/motions/motion-repository.service.ts +++ b/client/src/app/core/repositories/motions/motion-repository.service.ts @@ -537,39 +537,38 @@ export class MotionRepositoryService extends BaseIsAgendaItemAndListOfSpeakersCo return this.diff.getTextWithChanges(targetMotion.text, changes, lineLength, highlightLine); case ChangeRecoMode.Diff: let text = ''; - changes - .filter(change => { - return change.showInDiffView(); - }) - .forEach((change: ViewUnifiedChange, idx: number) => { - if (idx === 0) { - text += this.diff.extractMotionLineRange( - targetMotion.text, - { - from: 1, - to: change.getLineFrom() - }, - true, - lineLength, - highlightLine - ); - } else if (changes[idx - 1].getLineTo() < change.getLineFrom()) { - text += this.diff.extractMotionLineRange( - targetMotion.text, - { - from: changes[idx - 1].getLineTo(), - to: change.getLineFrom() - }, - true, - lineLength, - highlightLine - ); - } - text += this.diff.getChangeDiff(targetMotion.text, change, lineLength, highlightLine); - }); + const changesToShow = changes.filter(change => { + return change.showInDiffView(); + }); + changesToShow.forEach((change: ViewUnifiedChange, idx: number) => { + if (idx === 0) { + text += this.diff.extractMotionLineRange( + targetMotion.text, + { + from: 1, + to: change.getLineFrom() + }, + true, + lineLength, + highlightLine + ); + } else if (changes[idx - 1].getLineTo() < change.getLineFrom()) { + text += this.diff.extractMotionLineRange( + targetMotion.text, + { + from: changes[idx - 1].getLineTo(), + to: change.getLineFrom() + }, + true, + lineLength, + highlightLine + ); + } + text += this.diff.getChangeDiff(targetMotion.text, change, lineLength, highlightLine); + }); text += this.diff.getTextRemainderAfterLastChange( targetMotion.text, - changes, + changesToShow, lineLength, highlightLine ); diff --git a/client/src/app/site/motions/services/motion-pdf.service.ts b/client/src/app/site/motions/services/motion-pdf.service.ts index 2d972c69b..66ccd00f6 100644 --- a/client/src/app/site/motions/services/motion-pdf.service.ts +++ b/client/src/app/site/motions/services/motion-pdf.service.ts @@ -612,7 +612,6 @@ export class MotionPdfService { motionText = this.motionRepo.formatStatuteAmendment(statutes, motion, lineLength); } else { // lead motion or normal amendments - // TODO: Consider tile change recommendation const changes = this.getUnifiedChanges(motion, lineLength); const textChanges = changes.filter(change => !change.isTitleChange());