Skip to content

Commit

Permalink
Change vote weight to be displayed for nominal/non-nominal for entitl…
Browse files Browse the repository at this point in the history
…ed users list and handle anonymisedvotes list
  • Loading branch information
anbebe committed Nov 26, 2024
1 parent 5443788 commit 29d974f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ export abstract class BasePollPdfService {
margin: [0, 20, 0, 5],
bold: true
});
const usersData = this.createUsersTable(exportInfo.entitledUsersData, poll.type);
const usersData = this.createUsersTable(exportInfo.entitledUsersData);
pollResultPdfContent.push(usersData);
}

Expand Down Expand Up @@ -564,7 +564,8 @@ export abstract class BasePollPdfService {
* @returns the table as pdfmake object
*/
private createVotesTable(votesData: BaseVoteData[], pollType: PollType): object {
const showVoteWeight: boolean = this.activeVoteWeight && pollType == PollType.Named;
const isAnonymised: boolean = votesData[0].user ? false : true;
const showVoteWeight: boolean = this.activeVoteWeight && pollType == PollType.Named && !isAnonymised;
let pollTableBody: any[] = [];
const pollTableHeader = [
{
Expand Down Expand Up @@ -619,8 +620,8 @@ export abstract class BasePollPdfService {
*
* @returns the table as pdfmake object
*/
private createUsersTable(usersData: EntitledUsersTableEntry[], pollType: PollType): object {
const showVoteWeight: boolean = this.activeVoteWeight && pollType == PollType.Named;
private createUsersTable(usersData: EntitledUsersTableEntry[]): object {
const showVoteWeight: boolean = this.activeVoteWeight;
let pollTableBody: any[] = [];
const pollTableHeader = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ export class MotionPollDetailComponent extends BasePollDetailComponent<ViewMotio
return this.hasPerms() || this.poll.isPublished;
}

public get displayVoteWeight(): boolean {
return this.voteWeightEnabled && this.poll.isNamed;
}
public displayVoteWeight: boolean;

public constructor(
protected override translate: TranslateService,
Expand All @@ -40,6 +38,7 @@ export class MotionPollDetailComponent extends BasePollDetailComponent<ViewMotio
pollPdfService: MotionPollPdfService
) {
super(pollService, pollPdfService);
this.subscriptions.push(this.voteWeightEnabled.subscribe(data => (this.displayVoteWeight = data)));
}

protected createVotesData(): ExtendedVoteData[] {
Expand Down

0 comments on commit 29d974f

Please sign in to comment.