Motion Amendments into PDF
Support Amendments of initial motions in PDF
This commit is contained in:
parent
6364a04d22
commit
995fa7af32
@ -429,6 +429,15 @@ export class MotionRepositoryService extends BaseAgendaContentObjectRepository<V
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the amendments to a given motion
|
||||||
|
*
|
||||||
|
* @param motionId the motion ID to get the amendments to
|
||||||
|
*/
|
||||||
|
public getAmendmentsInstantly(motionId: number): ViewMotion[] {
|
||||||
|
return this.getViewModelList().filter(motion => motion.parent_id === motionId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Format the motion text using the line numbering and change
|
* Format the motion text using the line numbering and change
|
||||||
* reco algorithm.
|
* reco algorithm.
|
||||||
|
@ -515,9 +515,11 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit,
|
|||||||
* Merges amendments and change recommendations and sorts them by the line numbers.
|
* Merges amendments and change recommendations and sorts them by the line numbers.
|
||||||
* Called each time one of these arrays changes.
|
* Called each time one of these arrays changes.
|
||||||
*
|
*
|
||||||
* TODO: 1. Having logic in a service is bad practice
|
* TODO: 1. Having logic outside of a service is bad practice
|
||||||
* 2. Manipulating class parameters without an subscription should
|
* 2. Manipulating class parameters without an subscription should
|
||||||
* be avoided. It's safer and simpler to return values than to manipulate the scope
|
* be avoided. It's safer and simpler to return values than to manipulate the scope
|
||||||
|
* 3. This have been used three times so far. Here, in the projector and in the PDF. Find an own
|
||||||
|
* service to put the logic into.
|
||||||
*/
|
*/
|
||||||
private recalcUnifiedChanges(): void {
|
private recalcUnifiedChanges(): void {
|
||||||
if (!this.lineLength) {
|
if (!this.lineLength) {
|
||||||
|
@ -504,6 +504,18 @@ export class MotionPdfService {
|
|||||||
[],
|
[],
|
||||||
this.changeRecoRepo.getChangeRecoOfMotion(motion.id)
|
this.changeRecoRepo.getChangeRecoOfMotion(motion.id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// TODO: Cleanup, everything change reco and amendment based needs a unified structure.
|
||||||
|
const amendments = this.motionRepo.getAmendmentsInstantly(motion.id);
|
||||||
|
if (amendments) {
|
||||||
|
for (const amendment of amendments) {
|
||||||
|
const changedParagraphs = this.motionRepo.getAmendmentAmendedParagraphs(amendment, lineLength);
|
||||||
|
for (const change of changedParagraphs) {
|
||||||
|
changes.push(change as ViewUnifiedChange);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// changes need to be sorted, by "line from".
|
// changes need to be sorted, by "line from".
|
||||||
// otherwise, formatMotion will make unexpected results by messing up the
|
// otherwise, formatMotion will make unexpected results by messing up the
|
||||||
// order of changes applied to the motion
|
// order of changes applied to the motion
|
||||||
|
Loading…
Reference in New Issue
Block a user