Merge pull request #2773 from tsiegleauq/issue2709-special-values-election-pdf

add special voting values for missed options (fixes #2709)
This commit is contained in:
Norman Jäckel 2016-12-14 16:37:19 +01:00 committed by GitHub
commit 82b68f4387

View File

@ -131,9 +131,6 @@ angular.module('OpenSlidesApp.assignments.pdf', ['OpenSlidesApp.core.pdf'])
var resultBody = []; var resultBody = [];
angular.forEach(assignment.polls, function(poll, pollIndex) { angular.forEach(assignment.polls, function(poll, pollIndex) {
if (poll.published) { if (poll.published) {
var voteNrTotal = poll.votescast;
var voteNrValid = poll.votesvalid;
var voteNrInVal = poll.votesinvalid;
var pollTableBody = []; var pollTableBody = [];
resultBody.push({ resultBody.push({
@ -172,8 +169,7 @@ angular.module('OpenSlidesApp.assignments.pdf', ['OpenSlidesApp.core.pdf'])
angular.forEach(votes, function(vote) { angular.forEach(votes, function(vote) {
resultBlock.push(parseVoteValue(vote, true)); resultBlock.push(parseVoteValue(vote, true));
}); });
tableLine.push( tableLine.push({
{
text: resultBlock, text: resultBlock,
style: PDFLayout.flipTableRowStyle(pollTableBody.length) style: PDFLayout.flipTableRowStyle(pollTableBody.length)
} }
@ -182,42 +178,40 @@ angular.module('OpenSlidesApp.assignments.pdf', ['OpenSlidesApp.core.pdf'])
pollTableBody.push(tableLine); pollTableBody.push(tableLine);
}); });
//it is technically possible to make a single push-statement if (poll.votesvalid) {
//however, the flipTableRowStyle-function needs the current table size
if (voteNrValid) {
pollTableBody.push([ pollTableBody.push([
{ {
text: gettextCatalog.getString("Valid ballots"), text: gettextCatalog.getString("Valid ballots"),
style: 'tableConclude' style: 'tableConclude'
}, },
{ {
text: "" + voteNrValid, text: parseVoteValue(poll.getVote('votesvalid'), false),
style: 'tableConclude' style: 'tableConclude'
}, },
]); ]);
} }
if (voteNrInVal) { if (poll.votesinvalid) {
pollTableBody.push([ pollTableBody.push([
{ {
text: gettextCatalog.getString("Invalid ballots"), text: gettextCatalog.getString("Invalid ballots"),
style: 'tableConclude' style: 'tableConclude'
}, },
{ {
text: "" + voteNrInVal, text: parseVoteValue(poll.getVote('votesinvalid'), false),
style: 'tableConclude' style: 'tableConclude'
}, },
]); ]);
} }
if (voteNrTotal) { if (poll.votescast) {
pollTableBody.push([ pollTableBody.push([
{ {
text: gettextCatalog.getString("Casted ballots"), text: gettextCatalog.getString("Casted ballots"),
style: 'tableConclude' style: 'tableConclude'
}, },
{ {
text: "" + voteNrTotal, text: parseVoteValue(poll.getVote('votescast'), false),
style: 'tableConclude' style: 'tableConclude'
}, },
]); ]);