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 { ViewMediafile } from 'app/site/mediafiles/models/view-mediafile';
import { ViewTag } from 'app/site/tags/models/view-tag'; import { ViewTag } from 'app/site/tags/models/view-tag';
import { ViewUser } from 'app/site/users/models/view-user'; import { ViewUser } from 'app/site/users/models/view-user';
import { AmendmentType } from '../motions.constants';
import { ViewCategory } from './view-category'; import { ViewCategory } from './view-category';
import { ViewMotionBlock } from './view-motion-block'; import { ViewMotionBlock } from './view-motion-block';
import { ViewMotionChangeRecommendation } from './view-motion-change-recommendation'; import { ViewMotionChangeRecommendation } from './view-motion-change-recommendation';
@ -161,6 +162,20 @@ export class ViewMotion extends BaseViewModelWithAgendaItemAndListOfSpeakers<Mot
return !!this.amendments && !!this.amendments.length; 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 * 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) * getFilterOptions (as the workflows available may change)
*/ */
public stateFilterOptions: OsFilter = { public stateFilterOptions: OsFilter = {
property: 'state', property: 'state_id',
label: 'State', label: 'State',
options: [] options: []
}; };
public categoryFilterOptions: OsFilter = { public categoryFilterOptions: OsFilter = {
property: 'category', property: 'category_id',
label: 'Category',
options: [] options: []
}; };
@ -78,13 +79,13 @@ export class MotionFilterListService extends BaseFilterListService<ViewMotion> {
}; };
public recommendationFilterOptions: OsFilter = { public recommendationFilterOptions: OsFilter = {
property: 'recommendation', property: 'recommendation_id',
label: 'Recommendation', label: 'Recommendation',
options: [] options: []
}; };
public tagFilterOptions: OsFilter = { public tagFilterOptions: OsFilter = {
property: 'tags', property: 'tags_id',
label: 'Tags', label: 'Tags',
options: [] options: []
}; };