diff --git a/src/app/core/models/choice.model.ts b/src/app/core/models/choice.model.ts index cad0a832..bb5f14f3 100644 --- a/src/app/core/models/choice.model.ts +++ b/src/app/core/models/choice.model.ts @@ -2,12 +2,14 @@ import { Answer } from '../enums/answer.enum'; import { User } from './user.model'; export class Choice { + public id: number; + public name: string; + public created_at: string; + public score: number; + public enabled: boolean; + public url?: string; + constructor( - public id: number, - public name: string, - public created_at: string, - public enabled: boolean, - public url?: string, public participants: Map> = new Map>([ [Answer.YES, new Set()], [Answer.NO, new Set()], diff --git a/src/app/features/consultation/consultation.component.ts b/src/app/features/consultation/consultation.component.ts index 87f56e41..06e00045 100644 --- a/src/app/features/consultation/consultation.component.ts +++ b/src/app/features/consultation/consultation.component.ts @@ -14,7 +14,7 @@ import { Comment } from '../../core/models/comment.model'; 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; diff --git a/src/app/features/consultation/poll-results-compact/poll-results-compact.component.html b/src/app/features/consultation/poll-results-compact/poll-results-compact.component.html index 03ae5893..aa79c202 100644 --- a/src/app/features/consultation/poll-results-compact/poll-results-compact.component.html +++ b/src/app/features/consultation/poll-results-compact/poll-results-compact.component.html @@ -1,16 +1,19 @@ -{{ poll.choices_stats.length }} choix +{{ poll.choices.length }} choix
- + +
- +
@@ -24,19 +27,19 @@ diff --git a/src/app/features/consultation/poll-results-detailed/poll-results-detailed.component.html b/src/app/features/consultation/poll-results-detailed/poll-results-detailed.component.html index 2e173549..44e6e7fb 100644 --- a/src/app/features/consultation/poll-results-detailed/poll-results-detailed.component.html +++ b/src/app/features/consultation/poll-results-detailed/poll-results-detailed.component.html @@ -1,18 +1,62 @@ - + - - - - - - + + + + + + + + + + + + + + + + + + +
+ Choix + - {{ choice.name }} + + {{ choice.name }} + + {{ choice.name | date: 'short':'Europe/Paris':'fr_FR' }} +
+ Score + + + {{ choice.score }} +
+ Favori + + + + +
+ Personnes +
+
+ {{ stack.pseudo }} +
+
+ le {{ stack.created_at | date: 'short':'Europe/Paris':'fr_FR' }} +
+
+ {{ getValue(stack, item.id) }} +
diff --git a/src/app/features/consultation/poll-results-detailed/poll-results-detailed.component.scss b/src/app/features/consultation/poll-results-detailed/poll-results-detailed.component.scss index e69de29b..5feaefdb 100644 --- a/src/app/features/consultation/poll-results-detailed/poll-results-detailed.component.scss +++ b/src/app/features/consultation/poll-results-detailed/poll-results-detailed.component.scss @@ -0,0 +1,22 @@ +.background-yes { + background: #c1ffc0; +} + +.background-maybe { + background: #ffe4ca; +} + +.background-no { + background: #ffd7d7; +} + +table { + th, + th * { + background: #222; + color: white; + } + tr td:not(:first-of-type) { + text-align: center; + } +} diff --git a/src/app/features/consultation/poll-results-detailed/poll-results-detailed.component.ts b/src/app/features/consultation/poll-results-detailed/poll-results-detailed.component.ts index 2a78ef9b..e88994bd 100644 --- a/src/app/features/consultation/poll-results-detailed/poll-results-detailed.component.ts +++ b/src/app/features/consultation/poll-results-detailed/poll-results-detailed.component.ts @@ -19,4 +19,16 @@ export class PollResultsDetailedComponent implements OnInit { public buildAnswersByChoiceLabelByPseudo(): Map> { return this.pollService.buildAnswersByChoiceLabelByPseudo(this.poll); } + + stackHasVotesForChoice(stack, choice: any) { + return undefined !== stack.votes[choice]; + } + + getValue(stack, choice: any) { + if (this.stackHasVotesForChoice(stack, choice)) { + console.log('stack.votes[choice.id]', stack.votes[choice]); + return stack.votes[choice].value; + } + return null; + } }