Add ability to set a timer to 0 and abort the question round on demand.

parent 12700f23
Pipeline #11520 passed with stages
in 3 minutes and 9 seconds
This diff is collapsed.
......@@ -28,20 +28,20 @@
},
"private": true,
"dependencies": {
"@angular/animations": "^5.1.0",
"@angular/common": "^5.1.0",
"@angular/compiler": "^5.1.0",
"@angular/core": "^5.1.0",
"@angular/forms": "^5.1.0",
"@angular/http": "^5.1.0",
"@angular/platform-browser": "^5.1.0",
"@angular/platform-browser-dynamic": "^5.1.0",
"@angular/router": "^5.1.0",
"@ng-bootstrap/ng-bootstrap": "^1.0.0-beta.7",
"@angular/animations": "^5.1.3",
"@angular/common": "^5.1.3",
"@angular/compiler": "^5.1.3",
"@angular/core": "^5.1.3",
"@angular/forms": "^5.1.3",
"@angular/http": "^5.1.3",
"@angular/platform-browser": "^5.1.3",
"@angular/platform-browser-dynamic": "^5.1.3",
"@angular/router": "^5.1.3",
"@ng-bootstrap/ng-bootstrap": "^1.0.0-beta.8",
"@ngx-translate/core": "^8.0.0",
"@ngx-translate/http-loader": "^2.0.0",
"@ngx-translate/http-loader": "^2.0.1",
"@techiediaries/ngx-qrcode": "0.0.5",
"bootstrap": "^4.0.0-beta.2",
"bootstrap": "^4.0.0-beta.3",
"enhanced-resolve": "^3.4.1",
"highlight.js": "^9.12.0",
"intro.js": "^2.8.0-alpha.1",
......@@ -49,18 +49,18 @@
"marked": "git+https://github.com/trayhem/marked.git",
"messageformat": "^1.1.0",
"ngx-qrcode2": "0.0.5",
"ngx-translate-messageformat-compiler": "^2.0.1",
"ngx-translate-messageformat-compiler": "^2.1.0",
"popper.js": "^1.13.0",
"rxjs": "^5.5.5",
"zone.js": "^0.8.18"
"rxjs": "^5.5.6",
"zone.js": "^0.8.19"
},
"devDependencies": {
"@angular/cli": "^1.6.0",
"@angular/compiler-cli": "^5.1.0",
"@angular/language-service": "^5.1.0",
"@types/jasmine": "^2.8.2",
"@angular/cli": "^1.6.3",
"@angular/compiler-cli": "^5.1.3",
"@angular/language-service": "^5.1.3",
"@types/jasmine": "^2.8.3",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^8.0.58",
"@types/node": "^8.5.5",
"arsnova-click-v2-types": "git+https://git.thm.de/arsnova/arsnova-click-v2-types.git",
"codelyzer": "^4.0.2",
"http-server": "^0.10.0",
......@@ -70,11 +70,11 @@
"karma": "~1.7.1",
"karma-chrome-launcher": "~2.2.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.3.0",
"karma-coverage-istanbul-reporter": "^1.3.3",
"karma-jasmine": "^1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"node-sass": "^4.7.2",
"protractor": "^5.2.1",
"protractor": "^5.2.2",
"raw-loader": "^0.5.1",
"rimraf": "^2.6.2",
"sass-loader": "^6.0.3",
......@@ -82,7 +82,7 @@
"ts-node": "~3.3.0",
"tslint": "~5.8.0",
"typescript": "2.4.2",
"uglify-js": "^3.2.2"
"uglify-js": "^3.3.4"
},
"keywords": [
"arsnova",
......
......@@ -9,7 +9,7 @@
[id]="elem.id"
[routerLink]="getLinkTarget(elem)"
[attr.data-intro]="elem.showIntro ? (('region.footer.footer_bar.description.' + elem.id) | translate) : null"
(click)="toggleSetting(elem);elem.onClickCallback(elem)">
(click)="toggleSetting(elem)">
<p class="footerElemIcon"><i [class]="elem.iconClass" aria-hidden="true"></i></p>
<p class="footerElemText text-left ml-2"><span [class]="elem.textClass" [innerHTML]="elem.textName | translate"></span></p>
</div>
......
......@@ -45,6 +45,7 @@ export class FooterBarComponent implements OnInit, OnDestroy {
toggleSetting(elem: FooterbarElement) {
this.currentQuizService.toggleSetting(elem);
elem.onClickCallback(elem);
}
public fileChange(event: any) {
......
......@@ -20,12 +20,19 @@
<span [innerHTML]="('component.liveResults.' + (currentQuizService.quiz.sessionConfig.readingConfirmationEnabled ? currentQuizService.readingConfirmationRequested ? 'start_round' : 'show_question' : 'start_round')) | translate"></span>
<i class="fa fa-paper-plane"></i>
</button>
<button *ngIf="showStopQuizButton()"
<button *ngIf="showStopCountdownButton()"
(click)="stopQuiz()"
class="btn btn-default pointer"
[class.w-100]="!currentQuizService.getVisibleQuestions().length">
<span [innerHTML]="'component.liveResults.abort_countdown' | translate"></span>
<i class="fa fa-paper-plane"></i>
<i class="fa fa-ban"></i>
</button>
<button *ngIf="showStopQuizButton()"
(click)="stopQuiz()"
class="btn btn-default pointer"
[class.w-100]="!currentQuizService.getVisibleQuestions().length">
<span [innerHTML]="'component.liveResults.abort_question' | translate"></span>
<i class="fa fa-ban"></i>
</button>
<button *ngFor="let question of currentQuizService.getVisibleQuestions(); let i = index"
class="btn btn-default pointer"
......
......@@ -74,14 +74,15 @@ export class QuizResultsComponent implements OnInit, OnDestroy {
constructor(
public currentQuizService: CurrentQuizService,
public attendeeService: AttendeeService,
private http: HttpClient,
private router: Router,
private headerLabelService: HeaderLabelService,
private connectionService: ConnectionService,
private footerBarService: FooterBarService,
private i18nService: I18nService,
private questionTextService: QuestionTextService,
private attendeeService: AttendeeService) {
private questionTextService: QuestionTextService
) {
headerLabelService.headerLabel = 'component.liveResults.title';
......@@ -134,19 +135,41 @@ export class QuizResultsComponent implements OnInit, OnDestroy {
}
showStopQuizButton(): boolean {
return this.currentQuizService.isOwner &&
this.countdown &&
this.countdown.isRunning &&
this.countdown.remainingTime > 0;
return this.currentQuizService.isOwner
&& !this.currentQuizService.currentQuestion().timer
&&
(
this.attendeeService.attendees.length > this.attendeeService.attendees.filter(nick => {
return nick.responses[this.currentQuizService.questionIndex];
}).length
);
}
showStopCountdownButton(): boolean {
return this.currentQuizService.isOwner
&&
(
this.attendeeService.attendees.length > this.attendeeService.attendees.filter(nick => {
return nick.responses[this.currentQuizService.questionIndex];
}).length
) &&
(
this.countdown &&
this.countdown.isRunning &&
this.countdown.remainingTime > 0
);
}
showStartQuizButton(): boolean {
return this.currentQuizService.isOwner &&
(!this.countdown || !this.countdown.isRunning) &&
this.currentQuizService.questionIndex === this._selectedQuestionIndex &&
(this.currentQuizService.questionIndex < this.currentQuizService.quiz.questionList.length - 1 ||
this.currentQuizService.quiz.sessionConfig.readingConfirmationEnabled &&
this.currentQuizService.readingConfirmationRequested);
!this.showStopCountdownButton() &&
!this.showStopQuizButton() &&
this.currentQuizService.questionIndex === this._selectedQuestionIndex &&
(
this.currentQuizService.questionIndex < this.currentQuizService.quiz.questionList.length - 1 ||
this.currentQuizService.quiz.sessionConfig.readingConfirmationEnabled &&
this.currentQuizService.readingConfirmationRequested
);
}
hideProgressbarCssStyle(): boolean {
......@@ -316,7 +339,11 @@ export class QuizResultsComponent implements OnInit, OnDestroy {
} else {
this.currentQuizService.readingConfirmationRequested = false;
this.countdown = new Countdown(question, data.payload.startTimestamp);
if (question.timer) {
this.countdown = new Countdown(question, data.payload.startTimestamp);
}
if (this.currentQuizService.questionIndex === this.currentQuizService.quiz.questionList.length - 1) {
this.footerBarService.replaceFooterElements([
this.footerBarService.footerElemBack,
......@@ -364,7 +391,10 @@ export class QuizResultsComponent implements OnInit, OnDestroy {
this.http.get(url).subscribe((data: IMessage) => {
if (data.status === 'STATUS:SUCCESSFUL') {
const question = this.currentQuizService.currentQuestion();
this.countdown = new Countdown(question, data.payload.startTimestamp);
if (question.timer) {
this.countdown = new Countdown(question, data.payload.startTimestamp);
}
this.generateAnswers(question);
}
......@@ -376,9 +406,7 @@ export class QuizResultsComponent implements OnInit, OnDestroy {
}
this.handleMessages();
if (this.attendeeService.attendees.filter(attendee => {
return attendee.responses[this.currentQuizService.questionIndex] ?
attendee.responses[this.currentQuizService.questionIndex].value :
false;
return attendee.responses[this.currentQuizService.questionIndex];
}).length === this.attendeeService.attendees.length && this.countdown) {
this.countdown.stop();
}
......
<div id="countdown-header"
<div *ngIf="countdown && countdown.isRunning"
id="countdown-header"
class="overflow-hidden mb-3">
<div class="pull-left">
<i class="fa fa-users"></i>
......
......@@ -23,6 +23,9 @@ import {FreeTextQuestion} from 'arsnova-click-v2-types/src/questions/question_fr
styleUrls: ['./voting.component.scss']
})
export class VotingComponent implements OnInit, OnDestroy {
get countdown(): Countdown {
return this._countdown;
}
get selectedAnswers(): Array<number> | string | number {
return this._selectedAnswers;
}
......@@ -53,19 +56,25 @@ export class VotingComponent implements OnInit, OnDestroy {
this.http.get(`${DefaultSettings.httpApiEndpoint}/quiz/startTime/${currentQuizService.quiz.hashtag}`)
.subscribe((data: IMessage) => {
if (data.status === 'STATUS:SUCCESSFUL' && data.payload.startTimestamp) {
this._countdown = new Countdown(currentQuizService.currentQuestion(), data.payload.startTimestamp);
this._countdown.onChange.subscribe((value) => {
this._countdownValue = value;
if (!value) {
this.sendResponses();
}
});
if (currentQuizService.currentQuestion().timer) {
this._countdown = new Countdown(currentQuizService.currentQuestion(), data.payload.startTimestamp);
this._countdown.onChange.subscribe((value) => {
this._countdownValue = value;
if (!value) {
this.sendResponses();
}
});
}
} else {
this.router.navigate([
'/quiz',
'flow',
'results'
]);
}
});
}
......@@ -155,8 +164,10 @@ export class VotingComponent implements OnInit, OnDestroy {
}
sendResponses(): void {
this._countdown.onChange.unsubscribe();
this._countdown.stop();
if (this._countdown) {
this._countdown.onChange.unsubscribe();
this._countdown.stop();
}
this.router.navigate([
'/quiz',
'flow',
......
......@@ -117,12 +117,7 @@ export class NicknameManagerComponent implements OnInit, OnDestroy {
getNumberOfSelectedNicksOfCategory(category: string): number {
const selectedNicks = this.activeQuestionGroupService.activeQuestionGroup.sessionConfig.nicks.selectedNicks;
return this._availableNicks[category].filter(elem => {
if (category === 'emojis') {
const emojiMatch = elem.changingThisBreaksApplicationSecurity.match(/:[\w\+\-]+:/g);
return selectedNicks.indexOf(emojiMatch ? emojiMatch[0] : null) > -1;
} else {
return selectedNicks.indexOf(elem) > -1;
}
return selectedNicks.indexOf(elem) > -1;
}).length;
}
......
import marked from 'marked';
import * as marked from 'marked';
import highlight from 'highlight.js';
import {DefaultSettings} from '../default.settings';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment