Add amendment cr to lead motion slide

Adds amendment cr to the lead motion slide.
Previously the amendmet cr was only present in the amendment slide but was forgotten in the motion slide
This commit is contained in:
Sean Engelhardt 2020-09-18 16:02:16 +02:00 committed by Sean
parent de474e9eae
commit 823a87c164
4 changed files with 24 additions and 5 deletions

View File

@ -10,6 +10,7 @@ export interface MotionSlideDataAmendment {
id: number;
title: string;
amendment_paragraphs: string[];
change_recommendations: MotionSlideDataChangeReco[];
merge_amendment_into_final: number;
merge_amendment_into_diff: number;
}

View File

@ -79,9 +79,6 @@ export class MotionSlideComponent
);
}
console.log('cr mode? ', this.crMode);
console.log('the data: ', this._data);
this.recalcUnifiedChanges();
}
@ -216,8 +213,14 @@ export class MotionSlideComponent
}
if (this.data.data.amendments) {
this.data.data.amendments.forEach(amendment => {
if (amendment.change_recommendations?.length) {
const amendmentCRData = amendment.change_recommendations;
const amendmentCRs = amendmentCRData.map(cr => new MotionSlideObjChangeReco(cr));
this.allChangingObjects.push(...amendmentCRs);
} else {
const paras = this.getAmendmentAmendedParagraphs(amendment);
paras.forEach(para => this.allChangingObjects.push(para));
this.allChangingObjects.push(...paras);
}
});
}
this.allChangingObjects.sort((a: ViewUnifiedChange, b: ViewUnifiedChange) => {

View File

@ -71,18 +71,32 @@ async def get_amendments_for_motion(motion, all_data_provider):
amendment_data = []
for amendment_id in motion["amendments_id"]:
amendment = await all_data_provider.get("motions/motion", amendment_id)
merge_amendment_into_final = await get_amendment_merge_into_motion_final(
all_data_provider, amendment
)
merge_amendment_into_diff = await get_amendment_merge_into_motion_diff(
all_data_provider, amendment
)
# Add change recommendations to the amendments:
change_recommendations = [] # type: ignore
for change_recommendation_id in amendment["change_recommendations_id"]:
cr = await get_model(
all_data_provider,
"motions/motion-change-recommendation",
change_recommendation_id,
)
if cr is not None and not cr["internal"] and not cr["rejected"]:
change_recommendations.append(cr)
amendment_data.append(
{
"id": amendment["id"],
"identifier": amendment["identifier"],
"title": amendment["title"],
"amendment_paragraphs": amendment["amendment_paragraphs"],
"change_recommendations": change_recommendations,
"merge_amendment_into_diff": merge_amendment_into_diff,
"merge_amendment_into_final": merge_amendment_into_final,
}

View File

@ -276,6 +276,7 @@ async def test_motion_slide(all_data_provider):
"identifier": "Ä1",
"merge_amendment_into_final": 0,
"merge_amendment_into_diff": 0,
"change_recommendations": [],
}
],
"amendment_paragraphs": None,