reflekt 0.9.6 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,266 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
-
4
- <head>
5
- <meta charset="utf-8">
6
- <title>Reflekt</title>
7
- <meta name="description" content="Reflective testing results.">
8
- <meta name="author" content="Maedi Prichard">
9
- <meta name="viewport" content="width=device-width, initial-scale=1">
10
- <link rel="stylesheet" href="style.css">
11
- <link rel="shortcut icon" href="">
12
- <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap" rel="stylesheet">
13
- <link href="https://fonts.googleapis.com/css2?family=Merriweather&display=swap" rel="stylesheet">
14
- </head>
15
-
16
- <body>
17
-
18
- <script>
19
-
20
- // Reflection keys.
21
- const TIME = "t";
22
- const INPUT = "i";
23
- const OUTPUT = "o";
24
- const TYPE = "T";
25
- const COUNT = "C";
26
- const VALUE = "V";
27
- const STATUS = "s";
28
- const MESSAGE = "m";
29
- // Reflection values.
30
- const PASS = "p";
31
- const FAIL = "f";
32
-
33
- function getData() {
34
-
35
- var data = JSON.parse(<%= json %>);
36
- var results = {};
37
-
38
- console.log("DATA:");
39
- console.log(data);
40
-
41
- if ('reflekt' in data) {
42
- delete(data.reflekt);
43
- }
44
-
45
- // Classes.
46
- for ([class_id, class_value] of Object.entries(data)) {
47
-
48
- // Class pass rate.
49
- results[class_id] = {
50
- 'stats': {
51
- 'pass_rate': undefined,
52
- 'test_count': 0,
53
- 'pass_count': 0
54
- },
55
- 'methods': {}
56
- };
57
-
58
- // Methods.
59
- for ([method_id, method] of Object.entries(class_value)) {
60
-
61
- // Reflection pass rate.
62
- var pass_count = method.reflections.reduce(function(obj, v) {
63
- obj[v[STATUS]] = (obj[v[STATUS]] || 0) + 1;
64
- return obj;
65
- }, {});
66
-
67
- var pass_rate = (pass_count[PASS] / method.reflections.length) * 100;
68
- results[class_id]['methods'][method_id] = {
69
- 'stats': {
70
- 'pass_rate': pass_rate,
71
- 'test_count': method.reflections.length,
72
- 'pass_count': pass_count[PASS]
73
- }
74
- };
75
- if (pass_rate == 100) {
76
- results[class_id]['methods'][method_id]['status'] = 'pass';
77
- }
78
- else if (pass_rate < 100) {
79
- results[class_id]['methods'][method_id]['status'] = 'fail';
80
- }
81
-
82
- // Class pass rate.
83
- results[class_id]['stats']['test_count'] += method.reflections.length;
84
- results[class_id]['stats']['pass_count'] += pass_count[PASS];
85
-
86
- }
87
-
88
- // Class pass rate.
89
- var class_stats = results[class_id]['stats'];
90
- var pass_rate = (class_stats['pass_count'] / class_stats['test_count']) * 100;
91
- class_stats['pass_rate'] = pass_rate;
92
- if (pass_rate == 100) {
93
- results[class_id]['status'] = 'pass';
94
- }
95
- else if (pass_rate < 100) {
96
- results[class_id]['status'] = 'fail';
97
- }
98
- }
99
-
100
- return {
101
- data: data,
102
- results: results
103
- };
104
- }
105
-
106
- </script>
107
-
108
- <div class="container" x-data="getData()">
109
-
110
- <div id="header">
111
- <svg id="logo" enable-background="new 0 0 500 500" viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg">
112
- <path d="m307.5 80.5h-115l-57.5 205h230z" fill="#0047d0"/>
113
- <path d="m178 76.5-53.1-44-117.9 139 116 112z" fill="#d04800"/>
114
- <path d="m190.4 467.5h115l57.5-168h-229z" fill="#0047d0" opacity=".7"/>
115
- <path d="m177 467.5-81-85-92-197 115 113z" fill="#d04800" opacity=".7"/>
116
- <g fill="#008c33"><path d="m322 76.5 53.1-44 118 139-116 112z"/>
117
- <path d="m320 467.5 84-85 92-197-117 113z" opacity=".7"/>
118
- </g>
119
- </svg>
120
- </div>
121
-
122
- <ul class="classes">
123
- <template x-for="[class_id, klass] in Object.entries(results)" :key="class_id">
124
-
125
- <li class="class-container">
126
-
127
- <div class="status-row class" x-bind:class="`${klass.status}`" @click="klass['show'] = !klass['show']" :aria-expanded="klass['show'] ? 'true' : 'false'" :class="{ 'active': klass['show'] }">
128
- <h2 x-text="`${class_id}()`"></h2>
129
- <div class="stats">
130
- <div class="stat" x-text="`${klass.stats.pass_rate.toFixed(2)}%`"></div>
131
- </div>
132
- </div>
133
-
134
- <ul class="methods" x-show="klass['show']">
135
- <template x-for="[method_id, method] in Object.entries(klass['methods'])" :key="method_id">
136
- <li class="method-container">
137
-
138
- <div class="status-row method" x-bind:class="`${method.status}`" :class="{ 'active': method['show_reflections'] }" :class="{ 'active': method['show_controls'] }">
139
- <h3 x-text="`${method_id}()`"></h3>
140
- <div class="buttons">
141
- <button @click="method['show_controls'] = !method['show_controls']">Controls</button>
142
- <button @click="method['show_reflections'] = !method['show_reflections']">Reflections</button>
143
- </div>
144
- <div class="stats">
145
- <div class="stat" x-text="`${method.stats.pass_rate.toFixed(2)}%`"></div>
146
- </div>
147
- </div>
148
-
149
- <ul class="reflections" x-show="method['show_reflections']">
150
- <template x-for="[reflection_id, reflection] in Object.entries(data[class_id][method_id].reflections)">
151
-
152
- <li class="reflection">
153
-
154
- <div class="time" x-text="`${new Date(reflection.t * 1000).getFullYear()}/${new Date(reflection.t * 1000).getMonth() + 1}/${new Date(reflection.t * 1000).getDate()} ${new Date(reflection.t * 1000).getHours()}:${new Date(reflection.t * 1000).getMinutes()}:${new Date(reflection.t * 1000).getSeconds()}`"></div>
155
-
156
- <template x-for="[input_id, input] in Object.entries(reflection.i)">
157
-
158
- <div class="info">
159
- <h4>Input</h4>
160
- <div class="info-items">
161
- <div class="info-item">
162
- <strong>Type:</strong><div class="input" x-text="input.T"></div>
163
- </div>
164
- <template x-if="input.V != undefined">
165
- <div class="info-item">
166
- <strong>Value:</strong><pre><div class="output" x-text="input.V"></div></pre>
167
- </div>
168
- </template>
169
- <template x-if="input.C != undefined">
170
- <div class="info-item">
171
- <strong>Count:</strong><div class="input" x-text="input.C"></div>
172
- </div>
173
- </template>
174
- </div>
175
- </div>
176
-
177
- </template>
178
-
179
- <div class="info">
180
- <h4>Output</h4>
181
- <div class="info-items">
182
- <div class="info-item">
183
- <strong>Type:</strong><div class="output" x-text="reflection.o.T"></div>
184
- </div>
185
- <template x-if="reflection.o.C != undefined">
186
- <div class="info-item">
187
- <strong>Count:</strong><div class="output" x-text="reflection.o.C"></div>
188
- </div>
189
- </template>
190
- <div class="info-item">
191
- <strong>Value:</strong><pre><div class="output" x-text="reflection.o.V"></div></pre>
192
- </div>
193
- </div>
194
- </div>
195
- </li>
196
-
197
- </template>
198
- </ul>
199
-
200
- <ul class="controls" x-show="method['show_controls']">
201
- <template x-for="[control_id, control] in Object.entries(data[class_id][method_id].controls)">
202
-
203
- <li class="control">
204
-
205
- <div class="time" x-text="`${new Date(control.t * 1000).getFullYear()}/${new Date(control.t * 1000).getMonth() + 1}/${new Date(control.t * 1000).getDate()} ${new Date(control.t * 1000).getHours()}:${new Date(control.t * 1000).getMinutes()}:${new Date(control.t * 1000).getSeconds()}`"></div>
206
-
207
- <template x-for="[input_id, input] in Object.entries(control.i)">
208
-
209
- <div class="info">
210
- <h4>Input</h4>
211
- <div class="info-items">
212
- <div class="info-item">
213
- <strong>Type:</strong><div class="input" x-text="input.T"></div>
214
- </div>
215
- <template x-if="input.V != undefined">
216
- <div class="info-item">
217
- <strong>Value:</strong><pre><div class="output" x-text="input.V"></div></pre>
218
- </div>
219
- </template>
220
- <template x-if="input.C != undefined">
221
- <div class="info-item">
222
- <strong>Count:</strong><div class="input" x-text="input.C"></div>
223
- </div>
224
- </template>
225
- </div>
226
- </div>
227
-
228
- </template>
229
-
230
- <div class="info">
231
- <h4>Output</h4>
232
- <div class="info-items">
233
- <div class="info-item">
234
- <strong>Type:</strong><div class="output" x-text="control.o.T"></div>
235
- </div>
236
- <template x-if="control.o.C != undefined">
237
- <div class="info-item">
238
- <strong>Count:</strong><div class="output" x-text="control.o.C"></div>
239
- </div>
240
- </template>
241
- <div class="info-item">
242
- <strong>Value:</strong><pre><div class="output" x-text="control.o.V"></div></pre>
243
- </div>
244
- </div>
245
- </div>
246
- </li>
247
-
248
- </template>
249
- </ul>
250
-
251
- </li>
252
- </template>
253
- </ul>
254
-
255
- </li>
256
- </template>
257
-
258
- </ul>
259
-
260
- </div>
261
-
262
- <script src="script.js"></script>
263
-
264
- </body>
265
-
266
- </html>