diff --git a/src/app/components/stream/status/poll/poll.component.html b/src/app/components/stream/status/poll/poll.component.html
index 2b91918e..6801c025 100644
--- a/src/app/components/stream/status/poll/poll.component.html
+++ b/src/app/components/stream/status/poll/poll.component.html
@@ -25,7 +25,7 @@
refresh
-
·{{poll.votes_count}} votes· {{ poll.expires_at | timeLeft | async }}
+ ·{{poll.votes_count}} votes 0" class="poll__separator">· 0">{{poll.voters_count}} people· {{ poll.expires_at | timeLeft | async }}
Error occured when retrieving the poll
diff --git a/src/app/components/stream/status/poll/poll.component.ts b/src/app/components/stream/status/poll/poll.component.ts
index 1009d666..ef227e2d 100644
--- a/src/app/components/stream/status/poll/poll.component.ts
+++ b/src/app/components/stream/status/poll/poll.component.ts
@@ -48,7 +48,7 @@ export class PollComponent implements OnInit {
const maxVotes = Math.max(...this.poll.options.map(x => x.votes_count));
let i = 0;
for (let opt of this.poll.options) {
- let optWrapper = new PollOptionWrapper(i, opt, this.poll.votes_count, opt.votes_count === maxVotes);
+ let optWrapper = new PollOptionWrapper(i, opt, this.poll.votes_count, this.poll.voters_count, opt.votes_count === maxVotes);
this.options.push(optWrapper);
i++;
}
@@ -183,14 +183,19 @@ export class PollComponent implements OnInit {
}
class PollOptionWrapper implements PollOption {
- constructor(index: number, option: PollOption, totalVotes: number, isMax: boolean) {
+ constructor(index: number, option: PollOption, totalVotes: number, totalVoters: number, isMax: boolean) {
+ let votesDivider = totalVotes;
+ if(totalVoters && totalVoters > 0){
+ votesDivider = totalVoters;
+ }
+
this.id = index;
this.title = option.title;
this.votes_count = option.votes_count;
if (totalVotes === 0) {
this.percentage = '0';
} else {
- this.percentage = ((this.votes_count / totalVotes) * 100).toFixed(0);
+ this.percentage = ((this.votes_count / votesDivider) * 100).toFixed(0);
}
this.isMax = isMax;
}
diff --git a/src/app/services/models/mastodon.interfaces.ts b/src/app/services/models/mastodon.interfaces.ts
index c1668a7a..8debd55a 100644
--- a/src/app/services/models/mastodon.interfaces.ts
+++ b/src/app/services/models/mastodon.interfaces.ts
@@ -223,6 +223,7 @@ export interface Poll {
expired: boolean;
multiple: boolean;
votes_count: number;
+ voters_count: number;
options: PollOption[];
voted: boolean;
}