Skip to content

Commit

Permalink
Update getPollResult to avoid translate undefined (#4473)
Browse files Browse the repository at this point in the history
  • Loading branch information
reiterl authored Dec 11, 2024
1 parent 522ecd5 commit 277cf22
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,11 @@ export class TopicPdfService {
}
})
.map((singleResult: VotingResult) => {
const votingKey = this.translate.instant(this.pollKeyVerbose.transform(singleResult.vote!));
const pollKey = this.pollKeyVerbose.transform(singleResult.vote!);
const votingKey = pollKey ? `${this.translate.instant(pollKey)}: ` : ``;
const resultValue = this.parsePollNumber.transform(singleResult.amount!);
const resultInPercent = this.pollPercentBase.transform(singleResult.amount!, poll, votingResult);
return `${votingKey}${!!votingKey ? `: ` : ``}${resultValue} ${
return `${votingKey}${resultValue} ${
singleResult.showPercent && resultInPercent ? resultInPercent : ``
}`;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,11 @@ export class AssignmentPdfService {
}
})
.map((singleResult: VotingResult) => {
const votingKey = this.translate.instant(this.pollKeyVerbose.transform(singleResult.vote!));
const pollKey = this.pollKeyVerbose.transform(singleResult.vote!);
const votingKey = pollKey ? `${this.translate.instant(pollKey)}: ` : ``;
const resultValue = this.parsePollNumber.transform(singleResult.amount!);
const resultInPercent = this.pollPercentBase.transform(singleResult.amount!, poll, votingResult);
return `${votingKey}${!!votingKey ? `: ` : ``}${resultValue} ${
return `${votingKey}${resultValue} ${
singleResult.showPercent && resultInPercent ? resultInPercent : ``
}`;
});
Expand Down

0 comments on commit 277cf22

Please sign in to comment.