Fix PDF generation for motion with free amendments

Fixes an issue where motions which had free form amendments were not be
able to render as pdf
This commit is contained in:
Sean 2020-07-14 12:34:05 +02:00
parent 85a22ed99c
commit c2bd7c16a9

View File

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