Merge pull request #5568 from tsiegleauq/show-amendment-cr-in-lead-motion-slide

Add amendment cr to lead motion slide
This commit is contained in:
Sean 2020-10-07 18:17:52 +02:00 committed by GitHub
commit 70ea4f3658
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 5 deletions

View File

@ -10,6 +10,7 @@ export interface MotionSlideDataAmendment {
id: number; id: number;
title: string; title: string;
amendment_paragraphs: string[]; amendment_paragraphs: string[];
change_recommendations: MotionSlideDataChangeReco[];
merge_amendment_into_final: number; merge_amendment_into_final: number;
merge_amendment_into_diff: 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(); this.recalcUnifiedChanges();
} }
@ -216,8 +213,14 @@ export class MotionSlideComponent
} }
if (this.data.data.amendments) { if (this.data.data.amendments) {
this.data.data.amendments.forEach(amendment => { 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); const paras = this.getAmendmentAmendedParagraphs(amendment);
paras.forEach(para => this.allChangingObjects.push(para)); this.allChangingObjects.push(...paras);
}
}); });
} }
this.allChangingObjects.sort((a: ViewUnifiedChange, b: ViewUnifiedChange) => { 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 = [] amendment_data = []
for amendment_id in motion["amendments_id"]: for amendment_id in motion["amendments_id"]:
amendment = await all_data_provider.get("motions/motion", amendment_id) amendment = await all_data_provider.get("motions/motion", amendment_id)
merge_amendment_into_final = await get_amendment_merge_into_motion_final( merge_amendment_into_final = await get_amendment_merge_into_motion_final(
all_data_provider, amendment all_data_provider, amendment
) )
merge_amendment_into_diff = await get_amendment_merge_into_motion_diff( merge_amendment_into_diff = await get_amendment_merge_into_motion_diff(
all_data_provider, amendment 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( amendment_data.append(
{ {
"id": amendment["id"], "id": amendment["id"],
"identifier": amendment["identifier"], "identifier": amendment["identifier"],
"title": amendment["title"], "title": amendment["title"],
"amendment_paragraphs": amendment["amendment_paragraphs"], "amendment_paragraphs": amendment["amendment_paragraphs"],
"change_recommendations": change_recommendations,
"merge_amendment_into_diff": merge_amendment_into_diff, "merge_amendment_into_diff": merge_amendment_into_diff,
"merge_amendment_into_final": merge_amendment_into_final, "merge_amendment_into_final": merge_amendment_into_final,
} }

View File

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