Skip to content

Commit 3b23752

Browse files
committed
added more answers, to be more accurate.
1 parent d436570 commit 3b23752

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

js/quiz.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// variables
2-
var answers = new Object(); // Store user's answers
2+
var answers = new Object(); // Store user's answers
33
var qn = 0; // Current question order
44

55

66
// Populate questionsObject
77
let q_id_pop = 0;
8-
var questionsObject = new Object(); // Question objects with ID keys
8+
var questionsObject = new Object(); // Question objects with ID keys
99
questions.forEach(populateQO);
1010
function populateQO(value) {
1111
questionsObject[q_id_pop] = value;
@@ -72,12 +72,8 @@ function prev_question() {
7272

7373
// RESULTS
7474
function results() {
75-
// get from session storage
76-
window.sessionStorage.answers = JSON.stringify(answers);
77-
7875
// Calculate final results
7976
pct = percentageCalculation();
80-
window.sessionStorage.percentages = JSON.stringify(pct);
8177

8278
// prepare arguments
8379
var args = '?';
@@ -114,7 +110,7 @@ function percentageCalculation() {
114110
for(const id in answers) {
115111
// dismiss "don't know"
116112
if(answers[id] !== null) {
117-
for (const effectName in questionsObject[id].effects) {
113+
for(const effectName in questionsObject[id].effects) {
118114
max[effectName] += Math.abs(questionsObject[id].effects[effectName]);
119115
score[effectName] += answers[id]*questionsObject[id].effects[effectName];
120116
}

pages/quiz.html

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,16 @@ <h1 class="title" app-details="name"></h1>
2424
<section class="focus_question">
2525
<h2 style="text-align:center;" id="question-number">Loading...</h2>
2626
<p class="question" id="question-text"></p>
27-
<button class="button" onclick="next_question(1.0);" style="background-color: #1b5e20;">Strongly Agree</button> <br>
27+
<button class="button" onclick="next_question(1.0);" style="background-color: #1b5e20;">Extremely Agree</button> <br>
28+
<button class="button" onclick="next_question(0.75);" style="background-color: #26862d;">Strongly Agree</button> <br>
2829
<button class="button" onclick="next_question(0.5);" style="background-color: #4caf50;">Agree</button> <br>
30+
<button class="button" onclick="next_question(0.25);" style="background-color: #60dd65;">Kinda Agree</button> <br>
2931
<button class="button" onclick="next_question(0);" style="background-color: #333;">Neutral / Unsure</button> <br>
30-
<button class="button" onclick="next_question(-0.5);" style="background-color: #f44336;">Disagree</button> <br>
31-
<button class="button" onclick="next_question(-1.0);" style="background-color: #b71c1c;">Strongly Disagree</button> <br>
32+
<button class="button" onclick="next_question(-0.25);" style="background-color: #ff675c;">Kinda Disagree</button> <br>
33+
<button class="button" onclick="next_question(-0.5);" style="background-color: #df4035;">Disagree</button> <br>
34+
<button class="button" onclick="next_question(-0.75);" style="background-color: #b71c1c;">Strongly Disagree</button> <br>
35+
<button class="button" onclick="next_question(-1.0);" style="background-color: #741212;">Extremely Disagree</button> <br>
36+
<button class="button" onclick="next_question(null);" style="background-color: #6e6e6e;">Don't Know / Don't Understand</button> <br>
3237
<button class="small_button" onclick="prev_question();" id="back_button" style="background-color: #bbbbbb; color: #333;"> << Back</button>
3338
</section>
3439

0 commit comments

Comments
 (0)