-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-2.html
executable file
·268 lines (240 loc) · 11.1 KB
/
test-2.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Visualization Insights</title>
<!-- Bootstrap Core CSS -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="css/custom.css" rel="stylesheet">
<!-- Custom Fonts -->
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!-- Custom JavaScript -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="js/timeme.js"></script>
<!-- <script src="https://d3js.org/d3.v4.min.js"></script> -->
<script type="text/javascript">
var urlParams = new URLSearchParams(window.location.search);
var prolific_PID = urlParams.get('PROLIFIC_PID');
var session_ID = urlParams.get('SESSION_ID');
var mod = urlParams.get('modulo');
var conditions = urlParams.get('vis').split(",");
var responses = urlParams.get('selected').split(",");
var charts = urlParams.get('ch').split(",");
if (charts == "m") {n_regions = 12} else {n_regions = 8};
TimeMe.initialize({
currentPageName: "test-2", // current page
idleTimeoutInSeconds: 120, // stop recording time due to inactivity
});
</script>
</head>
<body>
<div class="row">
<div class="container-fluid">
<div class="col-sm-10 col-sm-offset-1">
<div class="row">
<div class="col-lg-10 col-lg-offset-1">
<h2 class="margin-top-md">Visualization Insights study</h2>
<h3>Recap: How your job performance is evaluated</h3>
<p>
<!-- <img id="payoff-img" src="images/payoff_5.png" align="right"> -->
<!-- Your job of picking out profitable regions without full sets of data is risky. You will win or lose corporate brownie points based on the rules below, and of course your goal is to maximize your points for the next promotion. -->
<!-- By clicking on a region, you indicate that you think the region has a profit greater than zero. Your goal is to maximise your points. -->
<ul>
<li>✅ If you <b>select</b> a region, and that region <b>does have</b> an average profit greater than zero based on all 200 stores, you will receive 20 points. <!-- This is a <i>True Positive</i>.--></li>
<li>✅ If you <b>do not select</b> a region, and that region <b>does not</b> have a profit greater than zero on average, you will receive 20 points. <!-- This is a <i>True Negative</i>. --></li>
<li>❌ If you <b>select</b> a region, and that region <b>does not</b> have a profit greater than zero, on average, you will lose <span class="highlight">380 points.</span><!-- This is a <i>False Positive</i>. --></li>
<li>❌ If you <b>do not select</b> a region, and that region <b>does have</b> a profit greater than zero, on average, you will lose 20 points. <!-- This is a <i>False Negative</i>. --></li>
</ul>
</p>
<h3>Your results for this tutorial</h3>
<p id="trial-answers">Your answers: </p>
<!-- <p>Correct answers: 2,3,5,8</p> -->
<p><span id="payoff">Total Payoff: 0</span></p>
<p>Note: if you <b><i>click on a region</i></b> and you are wrong, you will lose more than if you <b><i>don’t click on a region</i></b> and you are wrong</p>
</div>
</div>
<div class="row">
<div class="col-lg-2 col-sm-3">
<div class = "question-container" id = "opt-1">
<p class="region-label">Region 1</p>
<i class="material-icons correct-label" id="correct-1">check_circle</i>
<i class="material-icons incorrect-label" id="incorrect-1">cancel</i>
</div>
</div>
<div class="col-lg-2 col-sm-3">
<div class = "question-container" id = "opt-2">
<p class="region-label">Region 2</p>
<i class="material-icons correct-label" id="correct-2">check_circle</i>
<i class="material-icons incorrect-label" id="incorrect-2">cancel</i>
</div>
</div>
<div class="col-lg-2 col-sm-3">
<div class = "question-container" id = "opt-3">
<p class="region-label">Region 3</p>
<i class="material-icons correct-label" id="correct-3">check_circle</i>
<i class="material-icons incorrect-label" id="incorrect-3">cancel</i>
</div>
</div>
<div class="col-lg-2 col-sm-3">
<div class = "question-container" id = "opt-4">
<p class="region-label">Region 4</p>
<i class="material-icons correct-label" id="correct-4">check_circle</i>
<i class="material-icons incorrect-label" id="incorrect-4">cancel</i>
</div>
</div>
<div class="col-lg-2 col-sm-3">
<div class = "question-container" id = "opt-5">
<p class="region-label">Region 5</p>
<i class="material-icons correct-label" id="correct-5">check_circle</i>
<i class="material-icons incorrect-label" id="incorrect-5">cancel</i>
</div>
</div>
<div class="col-lg-2 col-sm-3">
<div class = "question-container" id = "opt-6">
<p class="region-label">Region 6</p>
<i class="material-icons correct-label" id="correct-6">check_circle</i>
<i class="material-icons incorrect-label" id="incorrect-6">cancel</i>
</div>
</div>
<div class="col-lg-2 col-sm-3">
<div class = "question-container" id = "opt-7">
<p class="region-label">Region 7</p>
<i class="material-icons correct-label" id="correct-7">check_circle</i>
<i class="material-icons incorrect-label" id="incorrect-7">cancel</i>
</div>
</div>
<div class="col-lg-2 col-sm-3">
<div class = "question-container" id = "opt-8">
<p class="region-label">Region 8</p>
<i class="material-icons correct-label" id="correct-8">check_circle</i>
<i class="material-icons incorrect-label" id="incorrect-8">cancel</i>
</div>
</div>
<div class="col-lg-2 col-sm-3">
<div class = "question-container" id = "opt-9">
<p class="region-label">Region 9</p>
<i class="material-icons correct-label" id="correct-9">check_circle</i>
<i class="material-icons incorrect-label" id="incorrect-9">cancel</i>
</div>
</div>
<div class="col-lg-2 col-sm-3">
<div class = "question-container" id = "opt-10">
<p class="region-label">Region 10</p>
<i class="material-icons correct-label" id="correct-10">check_circle</i>
<i class="material-icons incorrect-label" id="incorrect-10">cancel</i>
</div>
</div>
<div class="col-lg-2 col-sm-3">
<div class = "question-container" id = "opt-11">
<p class="region-label">Region 11</p>
<i class="material-icons correct-label" id="correct-11">check_circle</i>
<i class="material-icons incorrect-label" id="incorrect-11">cancel</i>
</div>
</div>
<div class="col-lg-2 col-sm-3">
<div class = "question-container" id = "opt-12">
<p class="region-label">Region 12</p>
<i class="material-icons correct-label" id="correct-12">check_circle</i>
<i class="material-icons incorrect-label" id="incorrect-12">cancel</i>
</div>
</div>
</div>
</div>
</div>
</div>
<div class = "row">
<div class="container">
<div class="btn-container">
<p>Clicking the button below will begin the study</p>
<div class="btn" id="submit-btn">Proceed</div>
</div>
</div>
</div>
</body>
<script type="text/javascript">
var img_order = [...Array(12).keys()].map(i => ++i);
$("p#trial-answers").text("You selected: " + responses + " (highlighted with blue borders)");
solution = [false, true, true, false, false, true, true, false, false, false, true, false];
responses = responses.map( i => parseInt(i));
non_responses = [];
for (var i of Array(12).keys()) {
if (!responses.includes(i+1) ) {
non_responses.push(i+1);
}
}
correct = []
for (i = 1; i <= solution.length; i++) {
// console.log(i, solution[i], non_responses.includes( ++i ), responses.includes( ++i))
if ((solution[i-1] == false) && non_responses.includes(i)) {
correct.push(true)
} else if ((solution[i-1] == true) && responses.includes(i)) {
correct.push(true)
} else {
correct.push(false)
}
}
for (i = 0; i < correct.length; i++) {
if (correct[i] == false) {
$("i#correct-"+(i+1)).hide()
} else {
$("i#incorrect-"+(i+1)).hide()
}
}
positives = []
negatives = []
responses.forEach(function (item, index) {
if (solution[item - 1] == true) {
positives.push(1)
} else {
positives.push(0)
}
});
non_responses.forEach(function (item, index) {
if (solution[item - 1] == false) {
negatives.push(1)
} else {
negatives.push(0)
}
});
const sum = (accumulator, currentVal) => accumulator + currentVal
tp = positives.reduce(sum);
tn = negatives.reduce(sum);
fp = positives.length - tp;
fn = negatives.length - tn;
cumulative_pay = (tp + tn) * 20 - (fp * 380 + fn * 20);
$("span#payoff").text("Payoff: " + cumulative_pay);
url = "https://raw.githubusercontent.com/MUCollective/vis-insight-reliability/stimuli/plots/example/profits-sol-t0-p0.5-";
$("div#opt-1").append('<img class = "question-graphic">').children().attr("src", url + img_order[0] + ".png");
$("div#opt-2").append('<img class = "question-graphic">').children().attr("src", url + img_order[1] + ".png");
$("div#opt-3").append('<img class = "question-graphic">').children().attr("src", url + img_order[2] + ".png");
$("div#opt-4").append('<img class = "question-graphic">').children().attr("src", url + img_order[3] + ".png");
$("div#opt-5").append('<img class = "question-graphic">').children().attr("src", url + img_order[4] + ".png");
$("div#opt-6").append('<img class = "question-graphic">').children().attr("src", url + img_order[5] + ".png");
$("div#opt-7").append('<img class = "question-graphic">').children().attr("src", url + img_order[6] + ".png");
$("div#opt-8").append('<img class = "question-graphic">').children().attr("src", url + img_order[7] + ".png");
$("div#opt-9").append('<img class = "question-graphic">').children().attr("src", url + img_order[8] + ".png");
$("div#opt-10").append('<img class = "question-graphic">').children().attr("src", url + img_order[9] + ".png");
$("div#opt-11").append('<img class = "question-graphic">').children().attr("src", url + img_order[10] + ".png");
$("div#opt-12").append('<img class = "question-graphic">').children().attr("src", url + img_order[11] + ".png");
for (i in responses) {
$("div#opt-" + responses[i]).addClass("selected");
}
var n = 30;
var index = null;
var trial_idx = null;
var i_sd = null;
$("div#submit-btn").on('click', submitResponse);
// send response to DB
function submitResponse() {
// uses global value for 'selected'
// Time spent on page
var t = Math.round(TimeMe.getTimeOnCurrentPageInSeconds() * 1000) / 1000;
window.location.href = 'intro.html?PROLIFIC_PID='+prolific_PID+'&SESSION_ID='+session_ID+'&modulo='+mod+'&vis='+conditions+'&ch='+charts+'';
}
</script>
</html>