diff --git a/src/app/dialogs/new-poll-item-dialog/new-poll-item-dialog.component.html b/src/app/dialogs/new-poll-item-dialog/new-poll-item-dialog.component.html index d15ef9c5..db39dc10 100644 --- a/src/app/dialogs/new-poll-item-dialog/new-poll-item-dialog.component.html +++ b/src/app/dialogs/new-poll-item-dialog/new-poll-item-dialog.component.html @@ -25,8 +25,10 @@
- diff --git a/src/app/dialogs/new-poll-item-dialog/new-poll-item-dialog.component.sass b/src/app/dialogs/new-poll-item-dialog/new-poll-item-dialog.component.sass index 3cd89190..3e666b07 100644 --- a/src/app/dialogs/new-poll-item-dialog/new-poll-item-dialog.component.sass +++ b/src/app/dialogs/new-poll-item-dialog/new-poll-item-dialog.component.sass @@ -29,3 +29,6 @@ nz-content .wrong-answer color: #ff194f + +.available-soon + margin-left: 10px diff --git a/src/app/dialogs/new-poll-item-dialog/new-poll-item-dialog.component.ts b/src/app/dialogs/new-poll-item-dialog/new-poll-item-dialog.component.ts index 08c7e1c2..fe9ccd24 100644 --- a/src/app/dialogs/new-poll-item-dialog/new-poll-item-dialog.component.ts +++ b/src/app/dialogs/new-poll-item-dialog/new-poll-item-dialog.component.ts @@ -21,27 +21,32 @@ const ITEM_TYPES = [ { id: 1, name: 'Open Text Question', - description: 'Enables the user to fill in a text as answer' + description: 'Enables the user to fill in a text as answer.', + available: true }, { id: 2, name: 'Multiple Choice Question', - description: 'Lets the user choose between several, pre-defined answers' + description: 'Lets the user choose between several, pre-defined answers.', + available: true }, { id: 3, name: 'Quiz Question', - description: 'Multiple choice question, which displays the right answer afterwards' + description: 'Multiple choice question which displays the right answer afterwards.', + available: true }, { id: 4, name: 'Word Cloud Question', - description: 'Single word can be entered. The words will be arranged in form of clouds' + description: 'Single word can be entered. The words will be arranged in form of clouds.', + available: false }, { id: 5, name: 'Rating Question', - description: 'Star rating.' + description: 'Star rating.', + available: false } ]; diff --git a/src/app/model/quiz-item-answer.ts b/src/app/model/quiz-item-answer.ts index b99f3145..0c470e6b 100644 --- a/src/app/model/quiz-item-answer.ts +++ b/src/app/model/quiz-item-answer.ts @@ -9,6 +9,4 @@ export class QuizItemAnswer { id: number; selectionOption: string; - isCorrect: boolean; - answerCount: number; } diff --git a/src/app/pages/poll-participants/poll-participants.component.html b/src/app/pages/poll-participants/poll-participants.component.html index 979d9034..8059d463 100644 --- a/src/app/pages/poll-participants/poll-participants.component.html +++ b/src/app/pages/poll-participants/poll-participants.component.html @@ -16,7 +16,7 @@

{{poll?.name}}

{{activeItem?.question}}

- +
@@ -50,6 +50,14 @@

{{activeItem?.question}}

nzTitle="Answer was sent" nzSubTitle="Waiting for the presenter to select another question ..."> + + + + Provided with ❤ by Live-Poll diff --git a/src/app/pages/poll-participants/poll-participants.component.ts b/src/app/pages/poll-participants/poll-participants.component.ts index 7f1b8e4c..ada1c1a5 100644 --- a/src/app/pages/poll-participants/poll-participants.component.ts +++ b/src/app/pages/poll-participants/poll-participants.component.ts @@ -21,12 +21,12 @@ export class PollParticipantsComponent implements OnInit, OnDestroy { // Variables slug = ''; - // poll: Poll = {id: 1, name: 'Test Poll', pollItems: [], currentItem: 1, slug: 'test', startDate: 0, endDate: 0}; poll: Poll; activeItem: MultipleChoiceItem|QuizItem|OpenTextItem; activeItemType = ''; answer = null; sent = false; + loading = true; /** * Initialize component @@ -52,13 +52,33 @@ export class PollParticipantsComponent implements OnInit, OnDestroy { // Connect to WebSocket const subscription = this.websocketService.establishConnection(this.slug); subscription.subscribe(pollItem => { - // Load poll - this.pollService.get(pollItem.pollId).subscribe(poll => this.poll = poll); - // Update UI - this.activeItemType = pollItem.type; - delete pollItem.type; - this.activeItem = pollItem; + if (Object.keys(pollItem).length > 1) { + // Load poll + if (!this.poll) { + this.pollService.get(pollItem.pollId).subscribe(poll => this.poll = poll); + } else { + this.poll.currentItem = pollItem.itemId; + } + // Randomize selection options if it is a quiz item + if (pollItem.type === 'quiz') { + pollItem.answers = this.toolsService.shuffleList(pollItem.answers); + } + // Update UI + this.activeItemType = pollItem.type; + delete pollItem.type; + this.activeItem = pollItem; + } else { + // Load poll + if (!this.poll) { + this.pollService.get(pollItem.id).subscribe(poll => this.poll = poll); + } else { + this.poll.currentItem = null; + } + this.activeItem = null; + this.activeItemType = ''; + } this.sent = false; + this.loading = false; }); }); } @@ -88,6 +108,7 @@ export class PollParticipantsComponent implements OnInit, OnDestroy { } if (this.websocketService.sendAnswer(this.activeItem.itemId, answerItem)) { this.sent = true; + this.answer = null; } else { this.toolsService.showErrorMessage('Could not send answer. Please try again. If the problem occurs again, please try to reload the page.'); } diff --git a/src/app/pages/poll/poll.component.html b/src/app/pages/poll/poll.component.html index 8a043273..5ee4059f 100644 --- a/src/app/pages/poll/poll.component.html +++ b/src/app/pages/poll/poll.component.html @@ -99,10 +99,6 @@
- @@ -110,7 +106,14 @@ + + + Running + {{pollItem.type}} + +