From fa4a1ae91e60b770a7385970913d5d23e6d1739d Mon Sep 17 00:00:00 2001 From: kj1352 Date: Fri, 3 Jul 2020 19:40:48 +0530 Subject: [PATCH] Question DS connected to start page + partial commit for question sheet page --- .../question-sheet.component.html | 15 +++- .../question-sheet.component.scss | 52 ++++++++++++++ .../question-sheet.component.ts | 30 ++++++-- .../courses/test/start/start.component.html | 10 +-- .../courses/test/start/start.component.scss | 12 +++- .../courses/test/start/start.component.ts | 4 +- src/app/tabs/courses/test/test.component.html | 3 +- src/app/tabs/courses/test/test.component.ts | 71 ++++++++++++++++++- 8 files changed, 180 insertions(+), 17 deletions(-) diff --git a/src/app/tabs/courses/test/question-sheet/question-sheet.component.html b/src/app/tabs/courses/test/question-sheet/question-sheet.component.html index 0c80937..78b4006 100644 --- a/src/app/tabs/courses/test/question-sheet/question-sheet.component.html +++ b/src/app/tabs/courses/test/question-sheet/question-sheet.component.html @@ -1 +1,14 @@ -

question-sheet works!

+
+
+
+ {{ answers.length }}/{{ questionCount }} +
+ +
+ + {{ timeCounter.hours }} : {{ timeCounter.minutes }} : {{ timeCounter.seconds }} +
+ + +
+
diff --git a/src/app/tabs/courses/test/question-sheet/question-sheet.component.scss b/src/app/tabs/courses/test/question-sheet/question-sheet.component.scss index e69de29..59721c8 100644 --- a/src/app/tabs/courses/test/question-sheet/question-sheet.component.scss +++ b/src/app/tabs/courses/test/question-sheet/question-sheet.component.scss @@ -0,0 +1,52 @@ +.page-container { + padding-bottom: 0; +} + +.main-header { + display: flex; + width: 100%; + height: 50px; + background-color: var(--ash-black); + justify-content: space-between; + align-items: center; + padding: 0 5%; + + .counter { + font-size: 14px; + color: var(--light-grey); + width: 50px; + + span { + color: var(--teal-green); + } + } + + button { + width: 50px; + height: 50px; + text-align: right; + background-color: transparent; + border: 0px; + + .icon { + width: 18px; + height: 18px; + fill: var(--light-grey); + } + } + + .duration { + color: var(--light-grey); + width: calc(100% - 100px); + font-size: 18px; + font-weight: 500; + letter-spacing: 1px; + text-align: center; + + .icon { + width: 14px; + height: 14px; + fill: var(--light-grey); + } + } +} diff --git a/src/app/tabs/courses/test/question-sheet/question-sheet.component.ts b/src/app/tabs/courses/test/question-sheet/question-sheet.component.ts index abc3398..6cd5a3f 100644 --- a/src/app/tabs/courses/test/question-sheet/question-sheet.component.ts +++ b/src/app/tabs/courses/test/question-sheet/question-sheet.component.ts @@ -1,15 +1,31 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, Input } from '@angular/core'; @Component({ - selector: 'app-question-sheet', - templateUrl: './question-sheet.component.html', - styleUrls: ['./question-sheet.component.scss'] + selector: 'app-question-sheet', + templateUrl: './question-sheet.component.html', + styleUrls: ['./question-sheet.component.scss'] }) export class QuestionSheetComponent implements OnInit { + @Input() testData: any; + answers = []; + questionCount = 0; + timeCounter = { + hours: 0, + minutes: 0, + seconds: 0 + }; - constructor() { } + constructor() { } - ngOnInit(): void { - } + ngOnInit(): void { + this.timeCounter.hours = Number((this.testData.durationInMinutes / 60).toFixed(0)); + this.timeCounter.minutes = Number((((this.testData.durationInMinutes / 60) - this.timeCounter.hours) * 60).toFixed(0)); + + for (let i = 0; i < this.testData.categoryList.length; i += 1) { + for (let j = 0; j < this.testData.categoryList[i].questions.length; j += 1) { + this.questionCount += 1; + } + } + } } diff --git a/src/app/tabs/courses/test/start/start.component.html b/src/app/tabs/courses/test/start/start.component.html index f3dae45..88b2f38 100644 --- a/src/app/tabs/courses/test/start/start.component.html +++ b/src/app/tabs/courses/test/start/start.component.html @@ -1,4 +1,4 @@ -
+