Skip to content
This repository was archived by the owner on Dec 31, 2022. It is now read-only.

Commit

Permalink
Adding participation count. Fixes #61
Browse files Browse the repository at this point in the history
  • Loading branch information
dessalines committed Jul 5, 2018
1 parent e3dc862 commit 30d9f9f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ui/src/app/components/poll/poll.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ <h4>Details</h4>
</td>
</tbody>
</table>
<span tooltip="{{this.poll.participation_pct}}%">Participation: {{this.poll.participation_pct.toFixed(0)}}%</span>
<span tooltip="{{this.poll.participationPct}}%">Participation: {{this.poll.participationPct.toFixed(0)}}% | {{poll.participationCount}} / {{poll.userListMatches.length}} votes</span>
</div>
</div>
<form class="needs-validation" #pollForm="ngForm" *ngIf="this.poll.editing" (ngSubmit)="updatePoll()">
Expand Down
5 changes: 3 additions & 2 deletions ui/src/app/components/poll/poll.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -517,8 +517,9 @@ export class PollComponent implements OnInit {
}
ulms.push(ulm);
}
this.poll.user_list_matches = ulms;
this.poll.participation_pct = participation / ulms.length * 100;
this.poll.userListMatches = ulms;
this.poll.participationCount = participation;
this.poll.participationPct = participation / ulms.length * 100;
return ulms;
}

Expand Down
5 changes: 3 additions & 2 deletions ui/src/app/shared/poll.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface Poll {
editing?: boolean;
readOnly?: boolean;
predefined_user_list?: string;
user_list_matches?: Array<UserListMatch>;
participation_pct?: number;
userListMatches?: Array<UserListMatch>;
participationPct?: number;
participationCount?: number;
}

0 comments on commit 30d9f9f

Please sign in to comment.