Temporary fix for the agenda item number during updates.

The changes in the agenda reposiroty can be reverted with #4738
This commit is contained in:
FinnStutzenstein 2019-06-06 09:44:34 +02:00
parent 1e8560c9a4
commit 4151797f60
2 changed files with 22 additions and 1 deletions

View File

@ -139,6 +139,27 @@ export class ItemRepositoryService extends BaseHasContentObjectRepository<
await this.httpService.delete(restUrl);
}
/**
* 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)
*
* Saves the (full) update to an existing model. So called "update"-function
* Provides a default procedure, but can be overwritten if required
*
* @param update the update that should be created
* @param viewModel the view model that the update is based on
*/
public async update(update: Partial<Item>, viewModel: ViewItem): Promise<void> {
const sendUpdate = new this.baseModelCtor();
sendUpdate.patchValues(viewModel.getModel());
sendUpdate.patchValues(update);
const clone = JSON.parse(JSON.stringify(sendUpdate));
clone.item_number = clone._itemNumber;
const restPath = `/rest/${sendUpdate.collectionString}/${sendUpdate.id}/`;
return await this.httpService.put(restPath, clone);
}
/**
* Get agenda visibility from the config
*

View File

@ -440,7 +440,7 @@ export class ListOfSpeakersComponent extends BaseViewComponent implements OnInit
if (!this.speakers || !this.speakers.length) {
this.filteredUsers.next(users);
} else {
this.filteredUsers.next(users.filter(u => !this.speakers.some(speaker => speaker.user.id === u.id)));
this.filteredUsers.next(users.filter(u => !this.speakers.some(speaker => speaker.userId === u.id)));
}
}
}