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 5010945af..e20d1c0b3 100644 --- a/client/src/app/core/repositories/motions/motion-repository.service.ts +++ b/client/src/app/core/repositories/motions/motion-repository.service.ts @@ -138,6 +138,12 @@ const MotionRelations: RelationDefinition[] = [ ownIdKey: 'change_recommendations_id', ownKey: 'changeRecommendations', foreignViewModel: ViewMotionChangeRecommendation + }, + { + type: 'O2M', + foreignIdKey: 'parent_id', + ownKey: 'amendments', + foreignViewModel: ViewMotion } // Personal notes are dynamically added in the repo. ]; diff --git a/client/src/app/core/ui-services/overlay.service.spec.ts b/client/src/app/core/ui-services/overlay.service.spec.ts index 1aea11e37..c7653c4f7 100644 --- a/client/src/app/core/ui-services/overlay.service.spec.ts +++ b/client/src/app/core/ui-services/overlay.service.spec.ts @@ -1,9 +1,15 @@ import { TestBed } from '@angular/core/testing'; +import { E2EImportsModule } from 'e2e-imports.module'; + import { OverlayService } from './overlay.service'; describe('OverlayService', () => { - beforeEach(() => TestBed.configureTestingModule({})); + beforeEach(() => + TestBed.configureTestingModule({ + imports: [E2EImportsModule] + }) + ); it('should be created', () => { const service: OverlayService = TestBed.get(OverlayService); diff --git a/client/src/app/shared/components/preview/preview.component.spec.ts b/client/src/app/shared/components/preview/preview.component.spec.ts index ccbaf3753..6ad3ca831 100644 --- a/client/src/app/shared/components/preview/preview.component.spec.ts +++ b/client/src/app/shared/components/preview/preview.component.spec.ts @@ -4,7 +4,7 @@ import { E2EImportsModule } from 'e2e-imports.module'; import { PreviewComponent } from './preview.component'; -fdescribe('PreviewComponent', () => { +describe('PreviewComponent', () => { let component: PreviewComponent; let fixture: ComponentFixture; diff --git a/client/src/app/shared/components/progress-snack-bar/progress-snack-bar.component.spec.ts b/client/src/app/shared/components/progress-snack-bar/progress-snack-bar.component.spec.ts index 208dcdc30..1c062a391 100644 --- a/client/src/app/shared/components/progress-snack-bar/progress-snack-bar.component.spec.ts +++ b/client/src/app/shared/components/progress-snack-bar/progress-snack-bar.component.spec.ts @@ -5,7 +5,7 @@ import { E2EImportsModule } from 'e2e-imports.module'; import { ProgressSnackBarComponent } from './progress-snack-bar.component'; -fdescribe('ProgressSnackBarComponent', () => { +describe('ProgressSnackBarComponent', () => { let component: ProgressSnackBarComponent; let fixture: ComponentFixture; diff --git a/client/src/app/site/common/components/super-search/super-search.component.spec.ts b/client/src/app/site/common/components/super-search/super-search.component.spec.ts index 702b6dfa2..e4a23d3f2 100644 --- a/client/src/app/site/common/components/super-search/super-search.component.spec.ts +++ b/client/src/app/site/common/components/super-search/super-search.component.spec.ts @@ -3,7 +3,7 @@ import { async, TestBed } from '@angular/core/testing'; // import { SuperSearchComponent } from './super-search.component'; import { E2EImportsModule } from 'e2e-imports.module'; -fdescribe('SuperSearchComponent', () => { +describe('SuperSearchComponent', () => { // let component: SuperSearchComponent; // let fixture: ComponentFixture; diff --git a/client/src/app/site/motions/models/view-motion.ts b/client/src/app/site/motions/models/view-motion.ts index 219862c03..665da9e9a 100644 --- a/client/src/app/site/motions/models/view-motion.ts +++ b/client/src/app/site/motions/models/view-motion.ts @@ -62,24 +62,6 @@ export interface MotionTitleInformation extends TitleInformationWithAgendaItem { */ export class ViewMotion extends BaseViewModelWithAgendaItemAndListOfSpeakers implements MotionTitleInformation, Searchable { - public static COLLECTIONSTRING = Motion.COLLECTIONSTRING; - protected _collectionString = Motion.COLLECTIONSTRING; - - protected _category?: ViewCategory; - protected _submitters?: ViewSubmitter[]; - protected _supporters?: ViewUser[]; - protected _workflow?: ViewWorkflow; - protected _state?: ViewState; - protected _recommendation?: ViewState; - protected _motion_block?: ViewMotionBlock; - protected _attachments?: ViewMediafile[]; - protected _tags?: ViewTag[]; - protected _parent?: ViewMotion; - protected _amendments?: ViewMotion[]; - protected _changeRecommendations?: ViewMotionChangeRecommendation[]; - protected _diffLines?: DiffLinesInParagraph[]; - public personalNote?: PersonalNoteContent; - public get motion(): Motion { return this._model; } @@ -368,10 +350,48 @@ export class ViewMotion extends BaseViewModelWithAgendaItemAndListOfSpeakers string; + /** + * Extract the lines of the amendments + * If an amendments has multiple changes, they will be printed like an array of strings + * + * @param amendment the motion to create the amendment to + * @return The lines of the amendment + */ + public getChangeLines(): string { + if (!!this.diffLines) { + return this.diffLines + .map(diffLine => { + if (diffLine.diffLineTo === diffLine.diffLineFrom + 1) { + return '' + diffLine.diffLineFrom; + } else { + return `${diffLine.diffLineFrom} - ${diffLine.diffLineTo - 1}`; + } + }) + .toString(); + } + } + /** * Formats the category for search * diff --git a/client/src/app/site/motions/modules/amendment-list/amendment-list.component.html b/client/src/app/site/motions/modules/amendment-list/amendment-list.component.html index f2d2bbba7..38eed4bcb 100644 --- a/client/src/app/site/motions/modules/amendment-list/amendment-list.component.html +++ b/client/src/app/site/motions/modules/amendment-list/amendment-list.component.html @@ -46,7 +46,7 @@  ·  Line -  {{ getChangeLines(motion) }} +  {{ motion.getChangeLines() }} @@ -106,6 +106,10 @@ archive Export +