fix models for backend update

This commit is contained in:
Tykayn 2021-04-26 17:04:16 +02:00 committed by tykayn
parent 163b89b03f
commit e45b490c2f
7 changed files with 27 additions and 27 deletions

View File

@ -1,7 +1,7 @@
import { User } from './user.model';
export class Comment {
constructor(public owner: User, public text: string, public pseudo: string, public created_at: string) {}
constructor(public text: string, public pseudo: string, public created_at: string) {}
public static sortChronologically(first: Comment, second: Comment): number {
const a = new Date(first.created_at);

View File

@ -39,7 +39,7 @@ export class Poll {
public votes = [];
public stacks_of_votes = [];
public stacks = [];
public allowed_answers = [];

View File

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

View File

@ -6,7 +6,7 @@
⚰️ Ce sondage a expiré, il n'est plus possible d'y ajouter de votes ou de commentaires
</div>
</article>
<article class="message is-info" *ngIf="poll.votes.length == 0">
<article class="message is-info" *ngIf="poll.stacks.length == 0">
<div class="message-body">
aucun vote pour le moment
</div>
@ -66,7 +66,7 @@
<div class="card-content">
<div class="content">
<p class="title is-2">{{ poll.description }}</p>
<p class="descr">{{ poll.description }}</p>
<button
class="btn is-info"
(click)="isCompactMode = !isCompactMode"
@ -82,7 +82,7 @@
Detailed
</button>
</div>
<app-poll-results-compact *ngIf="isCompactMode" [poll]="poll"></app-poll-results-compact>
<!-- <app-poll-results-compact *ngIf="isCompactMode" [poll]="poll"></app-poll-results-compact>-->
<app-poll-results-detailed *ngIf="!isCompactMode" [poll]="poll"></app-poll-results-detailed>
</div>
</div>

View File

@ -97,7 +97,7 @@ export class ConsultationComponent implements OnInit, OnDestroy {
});
listOfChoices.push('pseudo');
this.poll.stacks_of_votes.map((voteStack) => {
this.poll.stacks.map((voteStack) => {
const voteStackInArray = [voteStack.pseudo];
const keysVotes = Object.keys(voteStack.votes);

View File

@ -9,24 +9,24 @@
<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">
<img class="image is-24x24" src="../../../assets/img/icon_voter_YES.svg" />
<!-- <div class="column is-narrow">-->
<!-- <div class="buttons has-addons is-right" (click)="openModal(choice)">-->
<!-- <button class="button is-white">-->
<!-- <img class="image is-24x24" src="../../../assets/img/icon_voter_YES.svg" />-->
<span class="counter" *ngIf="choice.counts">
{{ choice.counts.get(answerEnum.YES) }}
</span>
</button>
<button class="button is-white" *ngIf="poll.allowed_answers.indexOf('maybe') !== -1">
<img class="image is-24x24" src="../../../assets/img/icon_voter_MAYBE.svg" />
<!-- <span class="counter" *ngIf="choice.counts">-->
<!-- {{ choice.counts.get(answerEnum.YES) }}-->
<!-- </span>-->
<!-- </button>-->
<!-- <button class="button is-white" *ngIf="poll.allowed_answers.indexOf('maybe') !== -1">-->
<!-- <img class="image is-24x24" src="../../../assets/img/icon_voter_MAYBE.svg" />-->
<!-- &lt;!&ndash; {{ choice.counts.get(answerEnum.MAYBE) }}&ndash;&gt;-->
<!-- </button>-->
<!-- <button class="button is-white" *ngIf="poll.allowed_answers.indexOf('no') !== -1">-->
<!-- <img class="image is-24x24" src="../../../assets/img/icon_voter_NO.svg" />-->
<!-- {{ choice.counts.get(answerEnum.MAYBE) }}-->
</button>
<button class="button is-white" *ngIf="poll.allowed_answers.indexOf('no') !== -1">
<img class="image is-24x24" src="../../../assets/img/icon_voter_NO.svg" />
<!-- {{ choice.counts.get(answerEnum.MAYBE) }}-->
</button>
</div>
</div>
<!-- </button>-->
<!-- </div>-->
<!-- </div>-->
</div>
</div>

View File

@ -69,8 +69,8 @@
<span class="date-days-ago is-small">
il y a
{{ calculateDaysAgoOfComment(comment.owner.created_at) }} jours, le </span
><span class="date is-small"> {{ comment.owner.created_at }} </span>
{{ calculateDaysAgoOfComment(comment.date.date) }} jours, le </span
><span class="date is-small"> {{ comment.date.date }} </span>
</p>
</div>
<div class="message-body">