From 87dc2cde7190e2411ea9250e1698b64880fbfff6 Mon Sep 17 00:00:00 2001 From: Angelique Weger Date: Wed, 3 Feb 2021 21:43:53 -0500 Subject: [PATCH 1/4] Creates SummaryStats component --- src/components/SummaryStats.vue | 80 +++++++++++++++++++++++++++++++++ src/views/Summary.vue | 26 ++--------- 2 files changed, 84 insertions(+), 22 deletions(-) create mode 100644 src/components/SummaryStats.vue diff --git a/src/components/SummaryStats.vue b/src/components/SummaryStats.vue new file mode 100644 index 0000000..31959bb --- /dev/null +++ b/src/components/SummaryStats.vue @@ -0,0 +1,80 @@ + + + + + diff --git a/src/views/Summary.vue b/src/views/Summary.vue index a986e25..a1db414 100644 --- a/src/views/Summary.vue +++ b/src/views/Summary.vue @@ -1,14 +1,14 @@ - + From 9a93a2caebf8a93424d9ce5e68f82bcce070489a Mon Sep 17 00:00:00 2001 From: Angelique Weger Date: Wed, 3 Feb 2021 21:47:41 -0500 Subject: [PATCH 2/4] Adds message and icon that score has been recorded as higest grade --- src/components/SummaryStats.vue | 17 ++++++++++++++++- src/components/icons/IconCheckmark.vue | 6 ++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 src/components/icons/IconCheckmark.vue diff --git a/src/components/SummaryStats.vue b/src/components/SummaryStats.vue index 31959bb..b31f668 100644 --- a/src/components/SummaryStats.vue +++ b/src/components/SummaryStats.vue @@ -4,13 +4,26 @@

Your Score

{{ getScore }}

Time Spent: {{ formattedDuration }} + + + + + Score recorded as grade + Finished: {{ formattedDate }} + + diff --git a/src/components/SummaryStats.vue b/src/components/SummaryStats.vue index 06b5df8..652c7d3 100644 --- a/src/components/SummaryStats.vue +++ b/src/components/SummaryStats.vue @@ -2,7 +2,10 @@

Summary

Your Score

-

{{ getScore }}

+ + {{ + displayScoreAsPercent + }} Time Spent: {{ formattedDuration }} @@ -18,11 +21,12 @@ import { mapGetters } from 'vuex'; import SvgIconContainer from './SvgIconContainer.vue'; import IconCheckmark from './icons/IconCheckmark.vue'; - +import ProgressBar from './ProgressBar'; export default { components: { SvgIconContainer, IconCheckmark, + ProgressBar, }, props: { data: { @@ -37,6 +41,9 @@ export default { countCorrect: 'quiz/countCorrect', getScore: 'quiz/calcScore', }), + displayScoreAsPercent() { + return this.getScore + '%'; + }, formattedDuration() { const durationArray = this.data.timeSpent.split(':'); const duration = []; @@ -93,6 +100,9 @@ h3 { .grade-details { font-size: $text-size-up-1; } +.progress-bar-label { + letter-spacing: 1px; +} svg { color: $color-salem; } diff --git a/src/store/modules/quiz.ts b/src/store/modules/quiz.ts index 928c66e..15a30ab 100644 --- a/src/store/modules/quiz.ts +++ b/src/store/modules/quiz.ts @@ -23,7 +23,7 @@ type Getters = { listQuestions(state: QuizStateInterface): Quiz['questions']; countQuestions(state: QuizStateInterface): number; countCorrect(state: QuizStateInterface): number; - calcScore(state: QuizStateInterface): string; + calcScore(state: QuizStateInterface): number; }; const getters: GetterTree & Getters = { @@ -53,7 +53,7 @@ const getters: GetterTree & Getters = { const totalQ = getters.countQuestions(state); const correctQ = getters.countCorrect(state); const score = (correctQ / totalQ) * 100; - return Math.floor(score) + '%'; + return Math.floor(score); }, };