Enumber Voting results

Enumber the rank of voting results in PDF, Projector and Detail View
This commit is contained in:
Sean 2021-05-05 14:49:42 +02:00
parent 7cf22b86ab
commit 18c75a6d12
2 changed files with 17 additions and 3 deletions

View File

@ -2,6 +2,7 @@
<table class="assignment-result-table" *ngIf="hasResults && canSeeResults">
<tbody>
<tr>
<td></td>
<th class="voting-option">{{ 'Candidates' | translate }}</th>
<th class="result yes" *ngIf="showYHeader">
<span *ngIf="!isMethodY">
@ -21,7 +22,10 @@
</th>
<th class="result abstain" *ngIf="isMethodYNA">{{ 'Abstain' | translate }}</th>
</tr>
<tr *ngFor="let row of tableData" [class]="row.class">
<tr *ngFor="let row of tableData; let i = index" [class]="row.class">
<td>
<span *ngIf="row.class === 'user'">{{ i + 1 }}.</span>
</td>
<td class="voting-option">
<div>
<span>
@ -50,6 +54,7 @@
</td>
</tr>
<tr *ngIf="isPercentBaseEntitled && poll.entitled_users_at_stop" class="entitled-users-row">
<td></td>
<td>{{ 'Entitled users' | translate }}</td>
<td class="result">
<div class="single-result">

View File

@ -175,6 +175,10 @@ export class AssignmentPdfService {
});
pollTableBody.push([
{
text: '',
style: 'tableHeader'
},
{
text: this.translate.instant('Candidates'),
style: 'tableHeader'
@ -186,10 +190,15 @@ export class AssignmentPdfService {
]);
const tableData = this.assignmentPollService.generateTableData(poll);
for (const pollResult of tableData) {
for (const [index, pollResult] of tableData.entries()) {
const rank = pollResult.class === 'user' ? index + 1 : '';
const voteOption = this.translate.instant(this.pollKeyVerbose.transform(pollResult.votingOption));
const resultLine = this.getPollResult(pollResult, poll);
const tableLine = [
{
text: rank
},
{
text: voteOption
},
@ -203,7 +212,7 @@ export class AssignmentPdfService {
resultBody.push({
table: {
widths: ['64%', '33%'],
widths: ['3%', '65%', '33%'],
headerRows: 1,
body: pollTableBody
},