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'; import { User } from './user.model';
export class Comment { 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 { public static sortChronologically(first: Comment, second: Comment): number {
const a = new Date(first.created_at); const a = new Date(first.created_at);

View File

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

View File

@ -160,7 +160,7 @@ 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.votes.forEach((choice: Choice) => { poll.choices.forEach((choice: Choice) => {
// choice.voters.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

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

View File

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

View File

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

View File

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