From 18c75a6d12acc20a49cd22bfd5870887dd237e2b Mon Sep 17 00:00:00 2001 From: Sean Date: Wed, 5 May 2021 14:49:42 +0200 Subject: [PATCH] Enumber Voting results Enumber the rank of voting results in PDF, Projector and Detail View --- .../assignment-poll-detail-content.component.html | 7 ++++++- .../assignments/services/assignment-pdf.service.ts | 13 +++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/client/src/app/shared/components/assignment-poll-detail-content/assignment-poll-detail-content.component.html b/client/src/app/shared/components/assignment-poll-detail-content/assignment-poll-detail-content.component.html index af581c843..4d0040bad 100644 --- a/client/src/app/shared/components/assignment-poll-detail-content/assignment-poll-detail-content.component.html +++ b/client/src/app/shared/components/assignment-poll-detail-content/assignment-poll-detail-content.component.html @@ -2,6 +2,7 @@ + - + + +
{{ 'Candidates' | translate }} @@ -21,7 +22,10 @@ {{ 'Abstain' | translate }}
+ {{ i + 1 }}. +
@@ -50,6 +54,7 @@
{{ 'Entitled users' | translate }}
diff --git a/client/src/app/site/assignments/services/assignment-pdf.service.ts b/client/src/app/site/assignments/services/assignment-pdf.service.ts index f2ebfbc50..491040f55 100644 --- a/client/src/app/site/assignments/services/assignment-pdf.service.ts +++ b/client/src/app/site/assignments/services/assignment-pdf.service.ts @@ -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 },