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>> {
const pseudos: Set<string> = new Set();
poll.choices.forEach((choice: Choice) => {
choice.participants.forEach((users: Set<User>) => {
poll.votes.forEach((choice: Choice) => {
choice.voters.forEach((users: Set<User>) => {
users.forEach((user: User) => {
pseudos.add(user.pseudo);
});

View File

@ -4,7 +4,11 @@
</div>
</div>
<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="column">
<div class="card">

View File

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

View File

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

View File

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