Merge pull request #5467 from tsiegleauq/pdf-error-free-text-amendment

Fix PDF generation for motion with free amendments
This commit is contained in:
Emanuel Schütze 2020-07-14 14:15:47 +02:00 committed by GitHub
commit 271ccdd46a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -630,17 +630,26 @@ export class MotionPdfService {
* @returns * @returns
*/ */
private getUnifiedChanges(motion: ViewMotion, lineLength: number): ViewUnifiedChange[] { private getUnifiedChanges(motion: ViewMotion, lineLength: number): ViewUnifiedChange[] {
return this.changeRecoRepo const changeRecosOfMotion = this.changeRecoRepo.getChangeRecoOfMotion(motion.id);
.getChangeRecoOfMotion(motion.id)
.concat( if (changeRecosOfMotion && changeRecosOfMotion.length) {
this.motionRepo.getAmendmentsInstantly(motion.id).flatMap((amendment: ViewMotion) => { return changeRecosOfMotion
const changeRecos = this.changeRecoRepo .concat(
.getChangeRecoOfMotion(amendment.id) this.motionRepo.getAmendmentsInstantly(motion.id).flatMap((amendment: ViewMotion) => {
.filter(reco => reco.showInFinalView()); const changeRecos = this.changeRecoRepo
return this.motionRepo.getAmendmentAmendedParagraphs(amendment, lineLength, changeRecos); .getChangeRecoOfMotion(amendment.id)
}) .filter(reco => reco.showInFinalView());
) if (changeRecos && changeRecos.length) {
.sort((a, b) => a.getLineFrom() - b.getLineFrom()) as ViewUnifiedChange[]; return this.motionRepo.getAmendmentAmendedParagraphs(amendment, lineLength, changeRecos);
}
})
)
.sort((a, b) => {
return a.getLineFrom() - b.getLineFrom();
});
} else {
return [];
}
} }
/** /**