diff --git a/client/src/app/site/assignments/components/assignment-poll/assignment-poll.component.html b/client/src/app/site/assignments/components/assignment-poll/assignment-poll.component.html index c79da1dba..a0133dc3e 100644 --- a/client/src/app/site/assignments/components/assignment-poll/assignment-poll.component.html +++ b/client/src/app/site/assignments/components/assignment-poll/assignment-poll.component.html @@ -80,7 +80,7 @@ - +
diff --git a/client/src/app/site/polls/components/poll-list/poll-list.component.html b/client/src/app/site/polls/components/poll-list/poll-list.component.html index ba6a5a482..a7eb6415a 100644 --- a/client/src/app/site/polls/components/poll-list/poll-list.component.html +++ b/client/src/app/site/polls/components/poll-list/poll-list.component.html @@ -1,5 +1,5 @@ -
List of votes
+
List of electronic votes
- + check_circle diff --git a/client/src/app/site/polls/models/view-base-poll.ts b/client/src/app/site/polls/models/view-base-poll.ts index 2d2497939..9154ab607 100644 --- a/client/src/app/site/polls/models/view-base-poll.ts +++ b/client/src/app/site/polls/models/view-base-poll.ts @@ -96,6 +96,16 @@ export abstract class ViewBasePoll< return MajorityMethodVerbose[this.majority_method]; } + public get hasVote(): boolean | null { + if (!this.user_has_voted && this.canBeVotedFor()) { + return false; + } else if (this.user_has_voted) { + return true; + } else { + return null; + } + } + public abstract get pollmethodVerbose(): string; public abstract get percentBaseVerbose(): string; diff --git a/client/src/app/site/polls/services/base-poll-repository.service.ts b/client/src/app/site/polls/services/base-poll-repository.service.ts index 0a1086fb5..5a06dca7a 100644 --- a/client/src/app/site/polls/services/base-poll-repository.service.ts +++ b/client/src/app/site/polls/services/base-poll-repository.service.ts @@ -53,7 +53,7 @@ export abstract class BasePollRepositoryService< protected createViewModelWithTitles(model: M): V { const viewModel = super.createViewModelWithTitles(model); Object.defineProperty(viewModel, 'canBeVotedFor', { - get: () => this.votingService.canVote(viewModel) + value: () => this.votingService.canVote(viewModel) }); return viewModel; } diff --git a/client/src/app/site/polls/services/poll-filter-list.service.ts b/client/src/app/site/polls/services/poll-filter-list.service.ts index 8059a73a0..8f12296d1 100644 --- a/client/src/app/site/polls/services/poll-filter-list.service.ts +++ b/client/src/app/site/polls/services/poll-filter-list.service.ts @@ -21,6 +21,14 @@ export class PollFilterListService extends BaseFilterListService { super(store, OSStatus); } + /** + * Filter out analog polls + * @param viewPoll All polls + */ + protected preFilter(viewPoll: ViewBasePoll[]): ViewBasePoll[] | void { + return viewPoll.filter(poll => !poll.isAnalog); + } + /** * @returns the filter definition */ @@ -37,19 +45,11 @@ export class PollFilterListService extends BaseFilterListService { ] }, { - property: 'canBeVotedFor', - label: this.translate.instant('Vote'), + property: 'hasVote', + label: this.translate.instant('Voting'), options: [ - { condition: true, label: this.translate.instant('Vote currently possible') }, - { condition: false, label: this.translate.instant('Vote not possible') } - ] - }, - { - property: 'user_has_voted', - label: this.translate.instant('Vote finished'), - options: [ - { condition: true, label: this.translate.instant('Has been voted for') }, - { condition: false, label: this.translate.instant('Has not been voted for') } + { condition: false, label: this.translate.instant('Voting is currently in progress.') }, + { condition: true, label: this.translate.instant('You have already voted.') } ] } ];