Repair motion filter for proxies

The View Model Proxies are currently breaking all filter operations.
This reparis the motion filters
This commit is contained in:
Sean Engelhardt 2019-10-23 15:25:56 +02:00
parent 62e5774c8d
commit 342b881af4
2 changed files with 20 additions and 4 deletions

View File

@ -11,6 +11,7 @@ import { Searchable } from 'app/site/base/searchable';
import { ViewMediafile } from 'app/site/mediafiles/models/view-mediafile';
import { ViewTag } from 'app/site/tags/models/view-tag';
import { ViewUser } from 'app/site/users/models/view-user';
import { AmendmentType } from '../motions.constants';
import { ViewCategory } from './view-category';
import { ViewMotionBlock } from './view-motion-block';
import { ViewMotionChangeRecommendation } from './view-motion-change-recommendation';
@ -161,6 +162,20 @@ export class ViewMotion extends BaseViewModelWithAgendaItemAndListOfSpeakers<Mot
return !!this.amendments && !!this.amendments.length;
}
/**
* Determine if the motion has parents, is a parent or neither
*/
public get amendmentType(): number {
if (this.hasAmendments) {
return AmendmentType.Parent;
} else if (this.hasParent) {
return AmendmentType.Amendment;
} else {
// not any amendment
return 0;
}
}
/**
* Get the number of the first diff line, in case a motion is an amendment
*/

View File

@ -55,13 +55,14 @@ export class MotionFilterListService extends BaseFilterListService<ViewMotion> {
* getFilterOptions (as the workflows available may change)
*/
public stateFilterOptions: OsFilter = {
property: 'state',
property: 'state_id',
label: 'State',
options: []
};
public categoryFilterOptions: OsFilter = {
property: 'category',
property: 'category_id',
label: 'Category',
options: []
};
@ -78,13 +79,13 @@ export class MotionFilterListService extends BaseFilterListService<ViewMotion> {
};
public recommendationFilterOptions: OsFilter = {
property: 'recommendation',
property: 'recommendation_id',
label: 'Recommendation',
options: []
};
public tagFilterOptions: OsFilter = {
property: 'tags',
property: 'tags_id',
label: 'Tags',
options: []
};