diff --git a/.travis.yml b/.travis.yml index 860bb9d15..d1f0310c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -85,11 +85,7 @@ matrix: - "3.6" script: - mypy openslides/ tests/ -<<<<<<< HEAD - - pytest --cov --cov-fail-under=72 -======= - - pytest --cov --cov-fail-under=74 ->>>>>>> Initial work for supporting voting + - pytest --cov --cov-fail-under=75 - name: "Server: Tests Python 3.7" language: python @@ -100,11 +96,7 @@ matrix: - isort --check-only --diff --recursive openslides tests - black --check --diff --target-version py36 openslides tests - mypy openslides/ tests/ -<<<<<<< HEAD - - pytest --cov --cov-fail-under=72 -======= - - pytest --cov --cov-fail-under=74 ->>>>>>> Initial work for supporting voting + - pytest --cov --cov-fail-under=75 - name: "Server: Tests Python 3.8" language: python @@ -115,7 +107,7 @@ matrix: - isort --check-only --diff --recursive openslides tests - black --check --diff --target-version py36 openslides tests - mypy openslides/ tests/ - - pytest --cov --cov-fail-under=72 + - pytest --cov --cov-fail-under=75 - name: "Client: Linting" language: node_js diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts index 6a1334f08..a01719ec2 100644 --- a/client/src/app/app.component.ts +++ b/client/src/app/app.component.ts @@ -114,14 +114,6 @@ export class AppComponent { .subscribe(() => servertimeService.startScheduler()); } - /** - * Function to alter the normal Array.toString - function - * - * Will add a whitespace after a comma and shorten the output to - * three strings. - * - * TODO: Should be renamed - */ private overloadArrayFunctions(): void { Object.defineProperty(Array.prototype, 'toString', { value: function(): string { @@ -153,7 +145,6 @@ export class AppComponent { enumerable: false }); - // intersect Object.defineProperty(Array.prototype, 'intersect', { value: function(other: T[]): T[] { let a = this; @@ -167,7 +158,6 @@ export class AppComponent { enumerable: false }); - // mapToObject Object.defineProperty(Array.prototype, 'mapToObject', { value: function(f: (item: T) => { [key: string]: any }): { [key: string]: any } { return this.reduce((aggr, item) => { @@ -188,18 +178,17 @@ export class AppComponent { * Adds some functions to Set. */ private overloadSetFunctions(): void { - // equals Object.defineProperty(Set.prototype, 'equals', { value: function(other: Set): boolean { - const _difference = new Set(this); + const difference = new Set(this); for (const elem of other) { - if (_difference.has(elem)) { - _difference.delete(elem); + if (difference.has(elem)) { + difference.delete(elem); } else { return false; } } - return !_difference.size; + return !difference.size; }, enumerable: false }); diff --git a/client/src/app/core/core-services/offline.service.ts b/client/src/app/core/core-services/offline.service.ts index 96dfff8f8..e869a7fb9 100644 --- a/client/src/app/core/core-services/offline.service.ts +++ b/client/src/app/core/core-services/offline.service.ts @@ -1,9 +1,9 @@ import { Injectable } from '@angular/core'; -import { _ } from 'app/core/translate/translation-marker'; import { TranslateService } from '@ngx-translate/core'; import { BehaviorSubject, Observable } from 'rxjs'; +import { _ } from 'app/core/translate/translation-marker'; import { BannerDefinition, BannerService } from '../ui-services/banner.service'; /** diff --git a/client/src/app/core/pdf-services/base-poll-pdf-service.ts b/client/src/app/core/pdf-services/base-poll-pdf-service.ts index d59a8c7e2..5e2e5de9e 100644 --- a/client/src/app/core/pdf-services/base-poll-pdf-service.ts +++ b/client/src/app/core/pdf-services/base-poll-pdf-service.ts @@ -71,7 +71,6 @@ export abstract class PollPdfService { * @returns the amount of ballots, depending on the config settings */ protected getBallotCount(): number { - // TODO: seems to be broken switch (this.ballotCountSelection) { case 'NUMBER_OF_ALL_PARTICIPANTS': return this.userRepo.getViewModelList().length; diff --git a/client/src/app/core/repositories/motions/motion-poll-repository.service.ts b/client/src/app/core/repositories/motions/motion-poll-repository.service.ts index 2b9d8d09a..87de50df6 100644 --- a/client/src/app/core/repositories/motions/motion-poll-repository.service.ts +++ b/client/src/app/core/repositories/motions/motion-poll-repository.service.ts @@ -9,6 +9,7 @@ import { ViewModelStoreService } from 'app/core/core-services/view-model-store.s import { RelationDefinition } from 'app/core/definitions/relations'; import { VotingService } from 'app/core/ui-services/voting.service'; import { MotionPoll } from 'app/shared/models/motions/motion-poll'; +import { VoteValue } from 'app/shared/models/poll/base-vote'; import { ViewMotion } from 'app/site/motions/models/view-motion'; import { ViewMotionOption } from 'app/site/motions/models/view-motion-option'; import { MotionPollTitleInformation, ViewMotionPoll } from 'app/site/motions/models/view-motion-poll'; @@ -91,7 +92,7 @@ export class MotionPollRepositoryService extends BasePollRepositoryService< return this.translate.instant(plural ? 'Polls' : 'Poll'); }; - public vote(vote: 'Y' | 'N' | 'A', poll_id: number): Promise { + public vote(vote: VoteValue, poll_id: number): Promise { return this.http.post(`/rest/motions/motion-poll/${poll_id}/vote/`, JSON.stringify(vote)); } } diff --git a/client/src/app/core/translate/marked-translations.ts b/client/src/app/core/translate/marked-translations.ts index 6a3685874..1f9dc3afb 100644 --- a/client/src/app/core/translate/marked-translations.ts +++ b/client/src/app/core/translate/marked-translations.ts @@ -99,7 +99,6 @@ _('Only main agenda items'); _('Topics'); _('Open requests to speak'); - // ** Motions ** // config strings // subgroup general @@ -246,7 +245,6 @@ _('Motion block'); _('The text field may not be blank.'); _('The reason field may not be blank.'); - // ** Assignments ** // Assignment config strings _('Elections'); @@ -257,7 +255,7 @@ _('All valid ballots'); _('All casted ballots'); _('Disabled (no percents)'); _('Default groups with voting rights'); -_('Sort election results by amount of votes') +_('Sort election results by amount of votes'); _('Put all candidates on the list of speakers'); // subgroup ballot papers _('Ballot papers'); @@ -291,7 +289,6 @@ _('Entitled to vote'); _('Voting method'); _('Amount of votes'); - // ** Users ** // permission strings (see models.py of each Django app) // agenda diff --git a/client/src/app/core/ui-services/voting-banner.service.ts b/client/src/app/core/ui-services/voting-banner.service.ts index 4b327f7e4..ce5c59e47 100644 --- a/client/src/app/core/ui-services/voting-banner.service.ts +++ b/client/src/app/core/ui-services/voting-banner.service.ts @@ -1,8 +1,8 @@ import { Injectable } from '@angular/core'; -import { _ } from 'app/core/translate/translation-marker'; import { TranslateService } from '@ngx-translate/core'; +import { _ } from 'app/core/translate/translation-marker'; import { ViewAssignmentPoll } from 'app/site/assignments/models/view-assignment-poll'; import { ViewMotionPoll } from 'app/site/motions/models/view-motion-poll'; import { ViewBasePoll } from 'app/site/polls/models/view-base-poll'; @@ -44,10 +44,7 @@ export class VotingBannerService { const banner = pollsToVote.length === 1 ? this.createBanner(this.getTextForPoll(pollsToVote[0]), pollsToVote[0].parentLink) - : this.createBanner( - `${pollsToVote.length} ${this.translate.instant('open votes')}`, - '/polls/' - ); + : this.createBanner(`${pollsToVote.length} ${this.translate.instant('open votes')}`, '/polls/'); this.sliceBanner(banner); } diff --git a/client/src/app/shared/components/attachment-control/attachment-control.component.ts b/client/src/app/shared/components/attachment-control/attachment-control.component.ts index 8eac84d1a..501807d2d 100644 --- a/client/src/app/shared/components/attachment-control/attachment-control.component.ts +++ b/client/src/app/shared/components/attachment-control/attachment-control.component.ts @@ -47,21 +47,15 @@ export class AttachmentControlComponent extends BaseFormControlComponent, @Optional() @Self() public ngControl: NgControl, private dialogService: MatDialog, private mediaService: MediafileRepositoryService ) { - super(fb, fm, element, ngControl); + super(formBuilder, focusMonitor, element, ngControl); } /** @@ -102,12 +96,15 @@ export class AttachmentControlComponent extends BaseFormControlComponent