montrer consultation et préciser si aucun vote

This commit is contained in:
tykayn 2021-04-24 12:46:26 +02:00 committed by Baptiste Lemoine
parent 21aa634ce5
commit 56273946c3
5 changed files with 18 additions and 11 deletions

View File

@ -160,8 +160,8 @@ export class PollService implements Resolve<Poll> {
public buildAnswersByChoiceLabelByPseudo(poll: Poll): Map<string, Map<string, Answer>> { public buildAnswersByChoiceLabelByPseudo(poll: Poll): Map<string, Map<string, Answer>> {
const pseudos: Set<string> = new Set(); const pseudos: Set<string> = new Set();
poll.choices.forEach((choice: Choice) => { poll.votes.forEach((choice: Choice) => {
choice.participants.forEach((users: Set<User>) => { choice.voters.forEach((users: Set<User>) => {
users.forEach((user: User) => { users.forEach((user: User) => {
pseudos.add(user.pseudo); pseudos.add(user.pseudo);
}); });

View File

@ -4,7 +4,11 @@
</div> </div>
</div> </div>
<section class="loading_poll" *ngIf="fetching"></section> <section class="loading_poll" *ngIf="fetching"></section>
<section class="poll_loaded" *ngIf="!fetching && poll"> <section class="poll_loaded padded" *ngIf="!fetching && poll">
<div class="alert alert-info" *ngIf="poll.votes.length == 0">
aucun vote pour le moment
</div>
<div class="columns"> <div class="columns">
<div class="column"> <div class="column">
<div class="card"> <div class="card">

View File

@ -11,7 +11,7 @@ import { PollService } from '../../core/services/poll.service';
styleUrls: ['./consultation.component.scss'], styleUrls: ['./consultation.component.scss'],
}) })
export class ConsultationComponent implements OnInit, OnDestroy { export class ConsultationComponent implements OnInit, OnDestroy {
public isCompactMode = true; public isCompactMode = false;
public poll: Poll; public poll: Poll;
public pollSlug: string; public pollSlug: string;
public passHash: string; public passHash: string;

View File

@ -3,6 +3,7 @@
<div class="column"> <div class="column">
<label class="label">{{ choice.name }}</label> <label class="label">{{ choice.name }}</label>
</div> </div>
<div class="column is-narrow"> <div class="column is-narrow">
<div class="buttons has-addons is-right" (click)="openModal(choice)"> <div class="buttons has-addons is-right" (click)="openModal(choice)">
<button class="button is-white"> <button class="button is-white">

View File

@ -2,15 +2,17 @@
<thead> <thead>
<tr> <tr>
<th></th> <th></th>
<th *ngFor="let choice of poll.choices">{{ choice.label }}</th> <th *ngFor="let choice of poll.choices">
{{ choice.name }}
</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<ng-container *ngFor="let item of buildAnswersByChoiceLabelByPseudo() | keyvalue"> <!-- <ng-container *ngFor="let item of buildAnswersByChoiceLabelByPseudo() | keyvalue">-->
<tr> <!-- <tr>-->
<td>{{ item.key }}</td> <!-- <td>{{ item.key }}</td>-->
<td *ngFor="let subItem of item.value | keyvalue">{{ subItem.value }}</td> <!-- <td *ngFor="let subItem of item.name | keyvalue">{{ subItem.name }}</td>-->
</tr> <!-- </tr>-->
</ng-container> <!-- </ng-container>-->
</tbody> </tbody>
</table> </table>