diff --git a/client/src/app/core/repositories/agenda/item-repository.service.ts b/client/src/app/core/repositories/agenda/item-repository.service.ts index 66b22f596..b6ad5e431 100644 --- a/client/src/app/core/repositories/agenda/item-repository.service.ts +++ b/client/src/app/core/repositories/agenda/item-repository.service.ts @@ -143,7 +143,7 @@ export class ItemRepositoryService extends BaseHasContentObjectRepository< /** * TODO: Copied from BaseRepository and added the cloned model to write back the - * item_number correctly. This must be reversed with #4738 (indroduced with #4639) + * item_number correctly. This must be reverted with #4738 (indroduced with #4639) * * Saves the (full) update to an existing model. So called "update"-function * Provides a default procedure, but can be overwritten if required @@ -152,6 +152,7 @@ export class ItemRepositoryService extends BaseHasContentObjectRepository< * @param viewModel the view model that the update is based on */ public async update(update: Partial, viewModel: ViewItem): Promise { + (update)._itemNumber = update.item_number; const sendUpdate = viewModel.getUpdatedModel(update); const clone = JSON.parse(JSON.stringify(sendUpdate)); clone.item_number = clone._itemNumber; diff --git a/client/src/app/core/repositories/agenda/list-of-speakers-repository.service.ts b/client/src/app/core/repositories/agenda/list-of-speakers-repository.service.ts index c3f918d8b..377ae5796 100644 --- a/client/src/app/core/repositories/agenda/list-of-speakers-repository.service.ts +++ b/client/src/app/core/repositories/agenda/list-of-speakers-repository.service.ts @@ -125,7 +125,7 @@ export class ListOfSpeakersRepositoryService extends BaseHasContentObjectReposit // TODO: This can be resolved with #4738 const item = this.itemRepo.findByContentObject(titleInformation.contentObjectData); if (item) { - (titleInformation.title_information).agenda_item_number = item.item_number; + (titleInformation.title_information).agenda_item_number = () => item.item_number; } return repo.getListOfSpeakersTitle(titleInformation.title_information); diff --git a/client/src/app/core/repositories/base-is-agenda-item-and-list-of-speakers-content-object-repository.ts b/client/src/app/core/repositories/base-is-agenda-item-and-list-of-speakers-content-object-repository.ts index d9481cdbb..40e4b960e 100644 --- a/client/src/app/core/repositories/base-is-agenda-item-and-list-of-speakers-content-object-repository.ts +++ b/client/src/app/core/repositories/base-is-agenda-item-and-list-of-speakers-content-object-repository.ts @@ -54,7 +54,7 @@ export abstract class BaseIsAgendaItemAndListOfSpeakersContentObjectRepository< public getAgendaListTitle(titleInformation: T): string { // Return the agenda title with the model's verbose name appended - const numberPrefix = titleInformation.agenda_item_number ? `${titleInformation.agenda_item_number} · ` : ''; + const numberPrefix = titleInformation.agenda_item_number() ? `${titleInformation.agenda_item_number()} · ` : ''; return numberPrefix + this.getTitle(titleInformation) + ' (' + this.getVerboseName() + ')'; } @@ -63,7 +63,7 @@ export abstract class BaseIsAgendaItemAndListOfSpeakersContentObjectRepository< } public getAgendaSlideTitle(titleInformation: T): string { - const numberPrefix = titleInformation.agenda_item_number ? `${titleInformation.agenda_item_number} · ` : ''; + const numberPrefix = titleInformation.agenda_item_number() ? `${titleInformation.agenda_item_number()} · ` : ''; return numberPrefix + this.getTitle(titleInformation); } diff --git a/client/src/app/core/repositories/base-is-agenda-item-content-object-repository.ts b/client/src/app/core/repositories/base-is-agenda-item-content-object-repository.ts index 3255dc42a..965ce9985 100644 --- a/client/src/app/core/repositories/base-is-agenda-item-content-object-repository.ts +++ b/client/src/app/core/repositories/base-is-agenda-item-content-object-repository.ts @@ -79,7 +79,7 @@ export abstract class BaseIsAgendaItemContentObjectRepository< */ public getAgendaListTitle(titleInformation: T): string { // Return the agenda title with the model's verbose name appended - const numberPrefix = titleInformation.agenda_item_number ? `${titleInformation.agenda_item_number} · ` : ''; + const numberPrefix = titleInformation.agenda_item_number() ? `${titleInformation.agenda_item_number()} · ` : ''; return numberPrefix + this.getTitle(titleInformation) + ' (' + this.getVerboseName() + ')'; } diff --git a/client/src/app/core/repositories/motions/motion-repository.service.ts b/client/src/app/core/repositories/motions/motion-repository.service.ts index 0e32fa2cc..a9e10c5ec 100644 --- a/client/src/app/core/repositories/motions/motion-repository.service.ts +++ b/client/src/app/core/repositories/motions/motion-repository.service.ts @@ -252,7 +252,7 @@ export class MotionRepositoryService extends BaseIsAgendaItemAndListOfSpeakersCo }; public getAgendaSlideTitle = (titleInformation: MotionTitleInformation) => { - const numberPrefix = titleInformation.agenda_item_number ? `${titleInformation.agenda_item_number} · ` : ''; + const numberPrefix = titleInformation.agenda_item_number() ? `${titleInformation.agenda_item_number()} · ` : ''; // if the identifier is set, the title will be 'Motion '. if (titleInformation.identifier) { return numberPrefix + this.translate.instant('Motion') + ' ' + titleInformation.identifier; @@ -262,7 +262,7 @@ export class MotionRepositoryService extends BaseIsAgendaItemAndListOfSpeakersCo }; public getAgendaListTitle = (titleInformation: MotionTitleInformation) => { - const numberPrefix = titleInformation.agenda_item_number ? `${titleInformation.agenda_item_number} · ` : ''; + const numberPrefix = titleInformation.agenda_item_number() ? `${titleInformation.agenda_item_number()} · ` : ''; // Append the verbose name only, if not the special format 'Motion ' is used. if (titleInformation.identifier) { return `${numberPrefix}${this.translate.instant('Motion')} ${titleInformation.identifier} · ${ diff --git a/client/src/app/core/repositories/topics/topic-repository.service.ts b/client/src/app/core/repositories/topics/topic-repository.service.ts index 148833c3b..188d4df41 100644 --- a/client/src/app/core/repositories/topics/topic-repository.service.ts +++ b/client/src/app/core/repositories/topics/topic-repository.service.ts @@ -52,8 +52,8 @@ export class TopicRepositoryService extends BaseIsAgendaItemAndListOfSpeakersCon } public getTitle = (titleInformation: TopicTitleInformation) => { - if (titleInformation.agenda_item_number) { - return titleInformation.agenda_item_number + ' · ' + titleInformation.title; + if (titleInformation.agenda_item_number()) { + return titleInformation.agenda_item_number() + ' · ' + titleInformation.title; } else { return titleInformation.title; } diff --git a/client/src/app/shared/models/agenda/item.ts b/client/src/app/shared/models/agenda/item.ts index 0dfea7598..80c8ff6ae 100644 --- a/client/src/app/shared/models/agenda/item.ts +++ b/client/src/app/shared/models/agenda/item.ts @@ -30,7 +30,7 @@ export class Item extends BaseModelWithContentObject { public set item_number(val: string) { this._itemNumber = val; if (this._titleInformation) { - this._titleInformation.agenda_item_number = this.item_number; + this._titleInformation.agenda_item_number = () => this.item_number; } } public get title_information(): object { @@ -38,7 +38,7 @@ export class Item extends BaseModelWithContentObject { } public set title_information(val: object) { this._titleInformation = val; - this._titleInformation.agenda_item_number = this.item_number; + this._titleInformation.agenda_item_number = () => this.item_number; } public comment: string; public closed: boolean; diff --git a/client/src/app/site/base/base-view-model-with-agenda-item.ts b/client/src/app/site/base/base-view-model-with-agenda-item.ts index cbe027892..0e239eb78 100644 --- a/client/src/app/site/base/base-view-model-with-agenda-item.ts +++ b/client/src/app/site/base/base-view-model-with-agenda-item.ts @@ -22,7 +22,7 @@ export function isBaseViewModelWithAgendaItem(obj: any): obj is BaseViewModelWit } export interface TitleInformationWithAgendaItem extends TitleInformation { - agenda_item_number?: string; + agenda_item_number?: () => string; } /** @@ -58,7 +58,7 @@ export interface BaseViewModelWithAgendaItem extends BaseProjectableViewModel { - public get agenda_item_number(): string | null { + public agenda_item_number(): string | null { return this.item && this.item.item_number ? this.item.item_number : null; } diff --git a/client/src/app/site/topics/models/view-topic.ts b/client/src/app/site/topics/models/view-topic.ts index 0bbdb9407..0643dba2e 100644 --- a/client/src/app/site/topics/models/view-topic.ts +++ b/client/src/app/site/topics/models/view-topic.ts @@ -7,7 +7,7 @@ import { ViewMediafile } from 'app/site/mediafiles/models/view-mediafile'; export interface TopicTitleInformation extends TitleInformationWithAgendaItem { title: string; - agenda_item_number?: string; + agenda_item_number?: () => string; } /** diff --git a/client/src/app/slides/agenda/item-list/item-list-slide-data.ts b/client/src/app/slides/agenda/item-list/item-list-slide-data.ts index 65a85da3c..e25d8b089 100644 --- a/client/src/app/slides/agenda/item-list/item-list-slide-data.ts +++ b/client/src/app/slides/agenda/item-list/item-list-slide-data.ts @@ -1,5 +1,10 @@ export interface SlideItem { - title_information: object; + title_information: { + collection: string; + depth: number; + _agenda_item_number: string; + agenda_item_number: () => string; + }; collection: string; depth: number; } diff --git a/client/src/app/slides/agenda/item-list/item-list-slide.component.ts b/client/src/app/slides/agenda/item-list/item-list-slide.component.ts index f1ed6efc4..5d040d732 100644 --- a/client/src/app/slides/agenda/item-list/item-list-slide.component.ts +++ b/client/src/app/slides/agenda/item-list/item-list-slide.component.ts @@ -1,7 +1,9 @@ -import { Component } from '@angular/core'; +import { Component, Input } from '@angular/core'; import { CollectionStringMapperService } from 'app/core/core-services/collection-string-mapper.service'; +import { SlideData } from 'app/core/core-services/projector-data.service'; import { isBaseIsAgendaItemContentObjectRepository } from 'app/core/repositories/base-is-agenda-item-content-object-repository'; +import { ProjectorElement } from 'app/shared/models/core/projector'; import { BaseSlideComponent } from 'app/slides/base-slide-component'; import { ItemListSlideData, SlideItem } from './item-list-slide-data'; @@ -11,6 +13,20 @@ import { ItemListSlideData, SlideItem } from './item-list-slide-data'; styleUrls: ['./item-list-slide.component.scss'] }) export class ItemListSlideComponent extends BaseSlideComponent { + @Input() + public set data(value: SlideData) { + value.data.items.forEach( + item => (item.title_information.agenda_item_number = () => item.title_information._agenda_item_number) + ); + this._data = value; + } + + public get data(): SlideData { + return this._data; + } + + private _data: SlideData; + public constructor(private collectionStringMapperService: CollectionStringMapperService) { super(); } diff --git a/openslides/agenda/projector.py b/openslides/agenda/projector.py index 9443acffc..0ee13e5a0 100644 --- a/openslides/agenda/projector.py +++ b/openslides/agenda/projector.py @@ -49,7 +49,7 @@ async def get_flat_tree(all_data: AllData, parent_id: int = 0) -> List[Dict[str, for item_id in item_ids: item = all_data["agenda/item"][item_id] title_information = item["title_information"] - title_information["agenda_item_number"] = item["item_number"] + title_information["_agenda_item_number"] = item["item_number"] tree.append( { "title_information": title_information, @@ -78,7 +78,7 @@ async def item_list_slide( for item in await get_sorted_agenda_items(all_data): if item["parent_id"] is None and item["type"] == 1: title_information = item["title_information"] - title_information["agenda_item_number"] = item["item_number"] + title_information["_agenda_item_number"] = item["item_number"] agenda_items.append( { "title_information": title_information, diff --git a/tests/unit/agenda/test_projector.py b/tests/unit/agenda/test_projector.py index 0e1458292..0f86a54ca 100644 --- a/tests/unit/agenda/test_projector.py +++ b/tests/unit/agenda/test_projector.py @@ -95,11 +95,11 @@ async def test_main_items(all_data): "items": [ { "collection": "topics/topic", - "title_information": {"title": "item1", "agenda_item_number": ""}, + "title_information": {"title": "item1", "_agenda_item_number": ""}, }, { "collection": "topics/topic", - "title_information": {"title": "item2", "agenda_item_number": ""}, + "title_information": {"title": "item2", "_agenda_item_number": ""}, }, ] } @@ -116,17 +116,17 @@ async def test_all_items(all_data): { "collection": "topics/topic", "depth": 0, - "title_information": {"title": "item1", "agenda_item_number": ""}, + "title_information": {"title": "item1", "_agenda_item_number": ""}, }, { "collection": "topics/topic", "depth": 1, - "title_information": {"title": "item4", "agenda_item_number": ""}, + "title_information": {"title": "item4", "_agenda_item_number": ""}, }, { "collection": "topics/topic", "depth": 0, - "title_information": {"title": "item2", "agenda_item_number": ""}, + "title_information": {"title": "item2", "_agenda_item_number": ""}, }, ] }