From 30d5eb5dec346efe21968300d530b0d79efc519d Mon Sep 17 00:00:00 2001 From: s416122 Date: Thu, 16 Jan 2020 23:47:21 +0100 Subject: [PATCH] =?UTF-8?q?PUNKT-61=20Dodanie=20ko=C5=82a=20ratunkowego=20?= =?UTF-8?q?-=20frontend?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../question-view/question-view.component.html | 4 ++-- .../question-view/question-view.component.ts | 7 +++++++ .../single-choice/single-choice.component.html | 13 ++++++++++--- .../single-choice/single-choice.component.ts | 13 +++++++++++++ .../tests/test-details/test-details.component.html | 2 +- .../tests/test-details/test-details.component.ts | 5 +++++ 6 files changed, 38 insertions(+), 6 deletions(-) diff --git a/FrontEnd/src/app/tests/test-details/question-view/question-view.component.html b/FrontEnd/src/app/tests/test-details/question-view/question-view.component.html index a2824b3..8823dd7 100644 --- a/FrontEnd/src/app/tests/test-details/question-view/question-view.component.html +++ b/FrontEnd/src/app/tests/test-details/question-view/question-view.component.html @@ -5,7 +5,7 @@
Pytanie jednokrotnego wyboru - +
Pytanie wielokrotnego wyboru @@ -23,4 +23,4 @@ Pytanie typu łączenie w pary
- \ No newline at end of file + diff --git a/FrontEnd/src/app/tests/test-details/question-view/question-view.component.ts b/FrontEnd/src/app/tests/test-details/question-view/question-view.component.ts index e22b177..3bcbbf2 100644 --- a/FrontEnd/src/app/tests/test-details/question-view/question-view.component.ts +++ b/FrontEnd/src/app/tests/test-details/question-view/question-view.component.ts @@ -10,7 +10,10 @@ export class QuestionViewComponent implements OnInit { question; @Input() private questionIndex; + @Input() activeFifty; @Output() emitNextQuestionRequest = new EventEmitter(); + @Output() lifebuoyTest = new EventEmitter(); + constructor() { } @@ -22,6 +25,10 @@ export class QuestionViewComponent implements OnInit { this.nextQuestion(e); } + LifebuoyFifty(y) { + this.lifebuoyTest.emit(y); + } + ngOnInit() { } diff --git a/FrontEnd/src/app/tests/test-details/question-view/single-choice/single-choice.component.html b/FrontEnd/src/app/tests/test-details/question-view/single-choice/single-choice.component.html index 14c8696..996c506 100644 --- a/FrontEnd/src/app/tests/test-details/question-view/single-choice/single-choice.component.html +++ b/FrontEnd/src/app/tests/test-details/question-view/single-choice/single-choice.component.html @@ -1,16 +1,23 @@
Pytanie za {{question.points}}pkt.
Czas: {{ timeLeft }} sek. Czas: bez limitu -
+
{{question.question}}
-
+
+
+
+ + + +
+
- + diff --git a/FrontEnd/src/app/tests/test-details/question-view/single-choice/single-choice.component.ts b/FrontEnd/src/app/tests/test-details/question-view/single-choice/single-choice.component.ts index 32c02a2..d3130db 100644 --- a/FrontEnd/src/app/tests/test-details/question-view/single-choice/single-choice.component.ts +++ b/FrontEnd/src/app/tests/test-details/question-view/single-choice/single-choice.component.ts @@ -14,12 +14,16 @@ export class SingleChoiceComponent implements OnInit, OnDestroy { private _question; private answer; @Output() emitNextQuestionRequest = new EventEmitter(); + @Output() lifebuoy = new EventEmitter(); + @Input() activeFifty; private id; private verifyAnswerSubscription: ISubscription; interval: any; public timeLeft = 0; + public fifty: Boolean = false; @ViewChild('f') public form: NgForm; + constructor(private route: ActivatedRoute, private testsService: TestsService) { } nextQuestion(f) { @@ -35,6 +39,15 @@ export class SingleChoiceComponent implements OnInit, OnDestroy { }); } + fiftyFifty() { + this.fifty = true; + this.lifebuoy.emit(false); + } + + noHelp() { + this.fifty = false; + } + startTimer() { this.interval = setInterval(() => { if (this.timeLeft > 0) { diff --git a/FrontEnd/src/app/tests/test-details/test-details.component.html b/FrontEnd/src/app/tests/test-details/test-details.component.html index a42222f..c1e54cd 100644 --- a/FrontEnd/src/app/tests/test-details/test-details.component.html +++ b/FrontEnd/src/app/tests/test-details/test-details.component.html @@ -38,7 +38,7 @@
- +
diff --git a/FrontEnd/src/app/tests/test-details/test-details.component.ts b/FrontEnd/src/app/tests/test-details/test-details.component.ts index 6b62c03..c325cbc 100644 --- a/FrontEnd/src/app/tests/test-details/test-details.component.ts +++ b/FrontEnd/src/app/tests/test-details/test-details.component.ts @@ -19,6 +19,7 @@ export class TestDetailsComponent implements OnInit, OnDestroy { currentQuestionIndex = 0; isEnded = false; points = 0; + public lifebuoyTest: Boolean = true; maxPoints = 0; prevMaxResult = 0; prevAnswerResultBool; @@ -78,6 +79,10 @@ export class TestDetailsComponent implements OnInit, OnDestroy { ); } + LifebuoyFifty(y) { + this.lifebuoyTest = y; + } + getMaxResult() { if (this.currentUser) { this.getResultSubscription = this.testService.getResult(this.test.id, this.currentUser.username).subscribe(d => {