From 86c0ff815f824b9119d36482cd85fc668eccf7cb Mon Sep 17 00:00:00 2001 From: Tykayn Date: Fri, 30 Apr 2021 15:42:50 +0200 Subject: [PATCH] group display of days --- .../components/header/header.component.html | 14 +++- src/app/core/models/poll.model.ts | 2 +- src/app/core/services/poll.service.ts | 24 ++---- .../success/success.component.html | 4 +- .../consultation/consultation.component.html | 6 +- .../consultation/consultation.component.ts | 2 +- .../poll-results-compact.component.html | 84 ++++++++++++++----- 7 files changed, 88 insertions(+), 48 deletions(-) diff --git a/src/app/core/components/header/header.component.html b/src/app/core/components/header/header.component.html index 24188ab8..bbe7f57f 100644 --- a/src/app/core/components/header/header.component.html +++ b/src/app/core/components/header/header.component.html @@ -51,7 +51,19 @@ Environnement de développement: voici des liens de démonstration issus des fixtures Doctrine de date-poll-api.
- + + + le-titre-de-demo-oh-oh + dessin-anime diff --git a/src/app/core/models/poll.model.ts b/src/app/core/models/poll.model.ts index 7b66cc90..cc940ff2 100644 --- a/src/app/core/models/poll.model.ts +++ b/src/app/core/models/poll.model.ts @@ -47,7 +47,7 @@ export class Poll { public choices: Choice[] = []; - public choicesDateGrouped: ChoiceGroup[] = []; + public choices_grouped: ChoiceGroup[] = []; public votes = []; diff --git a/src/app/core/services/poll.service.ts b/src/app/core/services/poll.service.ts index 85316d11..72e3f8aa 100644 --- a/src/app/core/services/poll.service.ts +++ b/src/app/core/services/poll.service.ts @@ -217,24 +217,12 @@ export class PollService implements Resolve { return newpoll; } + /** + * regrouper les jours et périodes de temps + * @param choices + */ public parseDateChoices(choices: Choice[]) { - const SEPARATOR_DATE_TIME_SLICE = ' >>> '; - const parsedChoices = []; - - for (const c of choices) { - const time_list = []; - const choice = { name: c.name }; - if (c.name.includes(SEPARATOR_DATE_TIME_SLICE)) { - const date_string = ''; - const time_slice = ''; - choice.name = time_slice; - } - parsedChoices.push({ - date_string: choice, - choices: c, - }); - } - console.log('parsedChoices', parsedChoices); - return []; + console.log('choices before', choices); + return choices; } } diff --git a/src/app/features/administration/success/success.component.html b/src/app/features/administration/success/success.component.html index 5c87e8e5..56d6c98a 100644 --- a/src/app/features/administration/success/success.component.html +++ b/src/app/features/administration/success/success.component.html @@ -30,7 +30,9 @@ Pour accéder au sondage et à tous ses paramètres : {{ poll.custom_url }}

- + Voir le sondage coté administrateur·ice diff --git a/src/app/features/consultation/consultation.component.html b/src/app/features/consultation/consultation.component.html index c195a8d2..59887051 100644 --- a/src/app/features/consultation/consultation.component.html +++ b/src/app/features/consultation/consultation.component.html @@ -116,9 +116,9 @@
-
- TODO links -
+ + +
diff --git a/src/app/features/consultation/consultation.component.ts b/src/app/features/consultation/consultation.component.ts index 53342e94..c6bdb655 100644 --- a/src/app/features/consultation/consultation.component.ts +++ b/src/app/features/consultation/consultation.component.ts @@ -53,7 +53,7 @@ export class ConsultationComponent implements OnInit, OnDestroy { this.poll.is_archived = this.isArchived; if (!environment.production) { - this.addVoteStack(); + // this.addVoteStack(); } } }); 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 8584c748..24c838e1 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,27 +1,65 @@ {{ poll.choices.length }} choix -
-
-
- - -
-
- - - -
-
- -
-
-
- - - +
+
+

+ {{ group.date_string }} +

+
+
+
+ + +
+
+ + + +
+
+ +
+
+
+ + + + +
+
+
+
+
+
+
+
+
+
+ + +
+
+ + + +
+
+ +
+
+
+ + + + +