@pie-lib/categorize 0.6.22 → 0.6.25
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.
- package/CHANGELOG.md +30 -186
- package/lib/index.js +20 -25
- package/lib/index.js.map +1 -1
- package/lib/scoring.js +7 -7
- package/lib/scoring.js.map +1 -1
- package/package.json +2 -2
- package/src/index.js +34 -50
- package/src/scoring.js +15 -15
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [0.6.
|
|
6
|
+
## [0.6.25](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.6.24...@pie-lib/categorize@0.6.25) (2022-11-23)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @pie-lib/categorize
|
|
9
9
|
|
|
@@ -11,369 +11,213 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
## [0.6.
|
|
14
|
+
## [0.6.24](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.6.22...@pie-lib/categorize@0.6.24) (2021-06-25)
|
|
15
15
|
|
|
16
16
|
**Note:** Version bump only for package @pie-lib/categorize
|
|
17
17
|
|
|
18
|
+
## [0.6.22](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.6.21...@pie-lib/categorize@0.6.22) (2021-02-15)
|
|
18
19
|
|
|
20
|
+
**Note:** Version bump only for package @pie-lib/categorize
|
|
19
21
|
|
|
22
|
+
## [0.6.21](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.6.19...@pie-lib/categorize@0.6.21) (2021-02-15)
|
|
20
23
|
|
|
24
|
+
**Note:** Version bump only for package @pie-lib/categorize
|
|
21
25
|
|
|
22
26
|
## [0.6.19](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.6.18...@pie-lib/categorize@0.6.19) (2021-02-15)
|
|
23
27
|
|
|
24
|
-
|
|
25
28
|
### Bug Fixes
|
|
26
29
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
- **categorize:** add alternate responses to updated model ([b2cb43b](https://github.com/pie-framework/pie-lib/commit/b2cb43b))
|
|
32
31
|
|
|
33
32
|
## [0.6.18](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.6.17...@pie-lib/categorize@0.6.18) (2020-05-15)
|
|
34
33
|
|
|
35
|
-
|
|
36
34
|
### Bug Fixes
|
|
37
35
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
- PD-45: The best scenario is not properly found. (If alternates defined => dychotomous) ([aa4d164](https://github.com/pie-framework/pie-lib/commit/aa4d164))
|
|
43
37
|
|
|
44
38
|
## [0.6.17](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.6.16...@pie-lib/categorize@0.6.17) (2020-04-27)
|
|
45
39
|
|
|
46
|
-
|
|
47
40
|
### Bug Fixes
|
|
48
41
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
42
|
+
- PD-193: Categorize authoring feature not working on pie-website ([5b14396](https://github.com/pie-framework/pie-lib/commit/5b14396))
|
|
54
43
|
|
|
55
44
|
## [0.6.16](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.6.15...@pie-lib/categorize@0.6.16) (2020-04-14)
|
|
56
45
|
|
|
57
46
|
**Note:** Version bump only for package @pie-lib/categorize
|
|
58
47
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
48
|
## [0.6.15](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.6.14...@pie-lib/categorize@0.6.15) (2020-04-08)
|
|
64
49
|
|
|
65
50
|
**Note:** Version bump only for package @pie-lib/categorize
|
|
66
51
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
52
|
## [0.6.14](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.6.13...@pie-lib/categorize@0.6.14) (2020-03-31)
|
|
72
53
|
|
|
73
54
|
**Note:** Version bump only for package @pie-lib/categorize
|
|
74
55
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
56
|
## [0.6.13](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.6.12...@pie-lib/categorize@0.6.13) (2020-03-31)
|
|
80
57
|
|
|
81
58
|
**Note:** Version bump only for package @pie-lib/categorize
|
|
82
59
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
60
|
## [0.6.12](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.6.11...@pie-lib/categorize@0.6.12) (2020-03-31)
|
|
88
61
|
|
|
89
62
|
**Note:** Version bump only for package @pie-lib/categorize
|
|
90
63
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
64
|
## [0.6.11](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.6.10...@pie-lib/categorize@0.6.11) (2020-03-30)
|
|
96
65
|
|
|
97
66
|
**Note:** Version bump only for package @pie-lib/categorize
|
|
98
67
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
68
|
## [0.6.10](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.6.9...@pie-lib/categorize@0.6.10) (2020-03-30)
|
|
104
69
|
|
|
105
70
|
**Note:** Version bump only for package @pie-lib/categorize
|
|
106
71
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
72
|
## [0.6.9](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.6.8...@pie-lib/categorize@0.6.9) (2020-03-30)
|
|
112
73
|
|
|
113
74
|
**Note:** Version bump only for package @pie-lib/categorize
|
|
114
75
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
76
|
## [0.6.8](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.6.7...@pie-lib/categorize@0.6.8) (2020-03-30)
|
|
120
77
|
|
|
121
78
|
**Note:** Version bump only for package @pie-lib/categorize
|
|
122
79
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
80
|
## [0.6.7](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.6.6...@pie-lib/categorize@0.6.7) (2020-03-30)
|
|
128
81
|
|
|
129
82
|
**Note:** Version bump only for package @pie-lib/categorize
|
|
130
83
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
84
|
## [0.6.6](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.6.5...@pie-lib/categorize@0.6.6) (2020-03-30)
|
|
136
85
|
|
|
137
86
|
**Note:** Version bump only for package @pie-lib/categorize
|
|
138
87
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
88
|
## [0.6.5](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.6.4...@pie-lib/categorize@0.6.5) (2020-03-30)
|
|
144
89
|
|
|
145
|
-
|
|
146
90
|
### Bug Fixes
|
|
147
91
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
92
|
+
- add module prop to package.json ([08f42fa](https://github.com/pie-framework/pie-lib/commit/08f42fa))
|
|
153
93
|
|
|
154
94
|
## [0.6.4](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.6.3...@pie-lib/categorize@0.6.4) (2020-03-29)
|
|
155
95
|
|
|
156
96
|
**Note:** Version bump only for package @pie-lib/categorize
|
|
157
97
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
98
|
## [0.6.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.6.2...@pie-lib/categorize@0.6.3) (2020-03-29)
|
|
163
99
|
|
|
164
|
-
|
|
165
100
|
### Bug Fixes
|
|
166
101
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
102
|
+
- add module prop to package.json ([9bbd235](https://github.com/pie-framework/pie-lib/commit/9bbd235))
|
|
172
103
|
|
|
173
104
|
## [0.6.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.6.1...@pie-lib/categorize@0.6.2) (2019-07-24)
|
|
174
105
|
|
|
175
|
-
|
|
176
106
|
### Bug Fixes
|
|
177
107
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
108
|
+
- **editor:** fixed the alternate response issue [ch1255](<[12a9abb](https://github.com/pie-framework/pie-lib/commit/12a9abb)>)
|
|
183
109
|
|
|
184
110
|
## [0.6.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.6.0...@pie-lib/categorize@0.6.1) (2019-06-20)
|
|
185
111
|
|
|
186
112
|
**Note:** Version bump only for package @pie-lib/categorize
|
|
187
113
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
114
|
# [0.6.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.5.14...@pie-lib/categorize@0.6.0) (2019-06-19)
|
|
193
115
|
|
|
194
|
-
|
|
195
116
|
### Features
|
|
196
117
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
118
|
+
- **buildState:** added alternate response support ([cbdf3cd](https://github.com/pie-framework/pie-lib/commit/cbdf3cd))
|
|
202
119
|
|
|
203
120
|
## [0.5.14](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.5.13...@pie-lib/categorize@0.5.14) (2019-03-15)
|
|
204
121
|
|
|
205
|
-
|
|
206
122
|
### Bug Fixes
|
|
207
123
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
124
|
+
- add foo two ([c53c9f2](https://github.com/pie-framework/pie-lib/commit/c53c9f2))
|
|
125
|
+
- rm child prepack in favour of root prepack ([381d8d6](https://github.com/pie-framework/pie-lib/commit/381d8d6))
|
|
214
126
|
|
|
215
127
|
## [0.5.13](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.5.12...@pie-lib/categorize@0.5.13) (2019-03-14)
|
|
216
128
|
|
|
217
|
-
|
|
218
129
|
### Bug Fixes
|
|
219
130
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
131
|
+
- rm foo ([6aa0200](https://github.com/pie-framework/pie-lib/commit/6aa0200))
|
|
225
132
|
|
|
226
133
|
## [0.5.12](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.5.11...@pie-lib/categorize@0.5.12) (2019-03-14)
|
|
227
134
|
|
|
228
135
|
**Note:** Version bump only for package @pie-lib/categorize
|
|
229
136
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
137
|
## [0.5.11](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.5.10...@pie-lib/categorize@0.5.11) (2019-03-14)
|
|
235
138
|
|
|
236
139
|
**Note:** Version bump only for package @pie-lib/categorize
|
|
237
140
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
141
|
## [0.5.10](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.5.9...@pie-lib/categorize@0.5.10) (2019-03-14)
|
|
243
142
|
|
|
244
143
|
**Note:** Version bump only for package @pie-lib/categorize
|
|
245
144
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
145
|
## [0.5.9](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.5.8...@pie-lib/categorize@0.5.9) (2019-03-14)
|
|
251
146
|
|
|
252
|
-
|
|
253
147
|
### Bug Fixes
|
|
254
148
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
149
|
+
- add FOO ([3d1b387](https://github.com/pie-framework/pie-lib/commit/3d1b387))
|
|
260
150
|
|
|
261
151
|
## [0.5.8](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.5.7...@pie-lib/categorize@0.5.8) (2019-03-13)
|
|
262
152
|
|
|
263
153
|
**Note:** Version bump only for package @pie-lib/categorize
|
|
264
154
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
155
|
## [0.5.7](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.5.6...@pie-lib/categorize@0.5.7) (2019-03-13)
|
|
270
156
|
|
|
271
|
-
|
|
272
157
|
### Bug Fixes
|
|
273
158
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
159
|
+
- call changelog in prepack ([e64ed5a](https://github.com/pie-framework/pie-lib/commit/e64ed5a))
|
|
279
160
|
|
|
280
161
|
## [0.5.6](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.5.4...@pie-lib/categorize@0.5.6) (2019-03-13)
|
|
281
162
|
|
|
282
|
-
|
|
283
163
|
### Bug Fixes
|
|
284
164
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
165
|
+
- foo ([4729044](https://github.com/pie-framework/pie-lib/commit/4729044))
|
|
290
166
|
|
|
291
167
|
## [0.5.5](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.5.4...@pie-lib/categorize@0.5.5) (2019-03-13)
|
|
292
168
|
|
|
293
|
-
|
|
294
169
|
### Bug Fixes
|
|
295
170
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
171
|
+
- foo ([4729044](https://github.com/pie-framework/pie-lib/commit/4729044))
|
|
301
172
|
|
|
302
173
|
## [0.5.4](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.5.2...@pie-lib/categorize@0.5.4) (2019-02-17)
|
|
303
174
|
|
|
304
|
-
|
|
305
175
|
### Bug Fixes
|
|
306
176
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
177
|
+
- force version bump ([dd057a5](https://github.com/pie-framework/pie-lib/commit/dd057a5))
|
|
312
178
|
|
|
313
179
|
## [0.5.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.5.1...@pie-lib/categorize@0.5.2) (2019-02-17)
|
|
314
180
|
|
|
315
|
-
|
|
316
181
|
### Bug Fixes
|
|
317
182
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
183
|
+
- babel ignore ([ea8327a](https://github.com/pie-framework/pie-lib/commit/ea8327a))
|
|
323
184
|
|
|
324
185
|
## [0.5.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.5.0...@pie-lib/categorize@0.5.1) (2019-01-30)
|
|
325
186
|
|
|
326
187
|
**Note:** Version bump only for package @pie-lib/categorize
|
|
327
188
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
189
|
# [0.5.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.4.2...@pie-lib/categorize@0.5.0) (2019-01-30)
|
|
333
190
|
|
|
334
|
-
|
|
335
191
|
### Features
|
|
336
192
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
193
|
+
- libs version bump ([2af1e56](https://github.com/pie-framework/pie-lib/commit/2af1e56))
|
|
342
194
|
|
|
343
195
|
<a name="0.4.2"></a>
|
|
344
|
-
## [0.4.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.4.1...@pie-lib/categorize@0.4.2) (2018-09-07)
|
|
345
196
|
|
|
197
|
+
## [0.4.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.4.1...@pie-lib/categorize@0.4.2) (2018-09-07)
|
|
346
198
|
|
|
347
199
|
### Bug Fixes
|
|
348
200
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
201
|
+
- make sure the correctResponse choices is an array before sorting ([d809de0](https://github.com/pie-framework/pie-lib/commit/d809de0))
|
|
353
202
|
|
|
354
203
|
<a name="0.4.1"></a>
|
|
355
|
-
## [0.4.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.4.0...@pie-lib/categorize@0.4.1) (2018-05-21)
|
|
356
|
-
|
|
357
|
-
|
|
358
204
|
|
|
205
|
+
## [0.4.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.4.0...@pie-lib/categorize@0.4.1) (2018-05-21)
|
|
359
206
|
|
|
360
207
|
**Note:** Version bump only for package @pie-lib/categorize
|
|
361
208
|
|
|
362
209
|
<a name="0.4.0"></a>
|
|
363
|
-
# [0.4.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.3.0...@pie-lib/categorize@0.4.0) (2018-05-21)
|
|
364
210
|
|
|
211
|
+
# [0.4.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/categorize@0.3.0...@pie-lib/categorize@0.4.0) (2018-05-21)
|
|
365
212
|
|
|
366
213
|
### Features
|
|
367
214
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
215
|
+
- expose score function ([8a5cbcd](https://github.com/pie-framework/pie-lib/commit/8a5cbcd))
|
|
372
216
|
|
|
373
217
|
<a name="0.3.0"></a>
|
|
374
|
-
# 0.3.0 (2018-05-21)
|
|
375
218
|
|
|
219
|
+
# 0.3.0 (2018-05-21)
|
|
376
220
|
|
|
377
221
|
### Features
|
|
378
222
|
|
|
379
|
-
|
|
223
|
+
- **categorize:** new categorize package ([d6d5fb9](https://github.com/pie-framework/pie-lib/commit/d6d5fb9))
|
package/lib/index.js
CHANGED
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
8
|
+
exports.removeChoiceFromCategory = exports.removeCategory = exports.removeAllChoices = exports.moveChoiceToCategory = exports.limitInArrays = exports.limitInArray = exports.limitChoices = exports.getBuiltCategories = exports.getAllPossibleResponses = exports.ensureNoExtraChoicesInAnswer = exports.countInChoices = exports.countInAnswer = exports.countChosen = exports.buildState = exports.buildChoices = exports.buildCategories = exports.FooTwo = void 0;
|
|
6
9
|
Object.defineProperty(exports, "score", {
|
|
7
10
|
enumerable: true,
|
|
8
11
|
get: function get() {
|
|
9
12
|
return _scoring.score;
|
|
10
13
|
}
|
|
11
14
|
});
|
|
12
|
-
exports.
|
|
15
|
+
exports.stillSelectable = void 0;
|
|
16
|
+
|
|
17
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
18
|
+
|
|
19
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
20
|
|
|
14
21
|
var _compact = _interopRequireDefault(require("lodash/compact"));
|
|
15
22
|
|
|
@@ -29,21 +36,9 @@ var _isUndefined = _interopRequireDefault(require("lodash/isUndefined"));
|
|
|
29
36
|
|
|
30
37
|
var _scoring = require("./scoring");
|
|
31
38
|
|
|
32
|
-
function
|
|
33
|
-
|
|
34
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
|
|
35
|
-
|
|
36
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
|
|
37
|
-
|
|
38
|
-
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
|
|
39
|
-
|
|
40
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
|
|
41
|
-
|
|
42
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
43
|
-
|
|
44
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
39
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
45
40
|
|
|
46
|
-
function
|
|
41
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
47
42
|
|
|
48
43
|
var FooTwo = 'foo-two';
|
|
49
44
|
exports.FooTwo = FooTwo;
|
|
@@ -244,7 +239,7 @@ var removeAllChoices = function removeAllChoices(choiceId, answers, categoryId)
|
|
|
244
239
|
(0, _remove["default"])(cloned, function (v) {
|
|
245
240
|
return v === choiceId;
|
|
246
241
|
});
|
|
247
|
-
return _objectSpread({}, a, {
|
|
242
|
+
return _objectSpread(_objectSpread({}, a), {}, {
|
|
248
243
|
choices: cloned
|
|
249
244
|
});
|
|
250
245
|
} else {
|
|
@@ -268,7 +263,7 @@ var removeChoiceFromCategory = function removeChoiceFromCategory(choiceId, categ
|
|
|
268
263
|
cloned.splice(index, 1);
|
|
269
264
|
}
|
|
270
265
|
|
|
271
|
-
return _objectSpread({}, a, {
|
|
266
|
+
return _objectSpread(_objectSpread({}, a), {}, {
|
|
272
267
|
choices: cloned
|
|
273
268
|
});
|
|
274
269
|
} else {
|
|
@@ -344,12 +339,12 @@ var buildChoices = function buildChoices(possibleResponseChoices, builtCategoryC
|
|
|
344
339
|
// set the correct: true
|
|
345
340
|
|
|
346
341
|
if (index >= 0) {
|
|
347
|
-
acc.builtChoices.push(_objectSpread({}, builtChoice, {
|
|
342
|
+
acc.builtChoices.push(_objectSpread(_objectSpread({}, builtChoice), {}, {
|
|
348
343
|
correct: true
|
|
349
344
|
}));
|
|
350
|
-
acc.copyOfPossibleResponse = [].concat(
|
|
345
|
+
acc.copyOfPossibleResponse = [].concat((0, _toConsumableArray2["default"])(acc.copyOfPossibleResponse.slice(0, index)), (0, _toConsumableArray2["default"])(acc.copyOfPossibleResponse.slice(index + 1)));
|
|
351
346
|
} else {
|
|
352
|
-
acc.builtChoices.push(_objectSpread({}, builtChoice, {
|
|
347
|
+
acc.builtChoices.push(_objectSpread(_objectSpread({}, builtChoice), {}, {
|
|
353
348
|
correct: false
|
|
354
349
|
}));
|
|
355
350
|
acc.allChoicesAreCorrect = false;
|
|
@@ -358,7 +353,7 @@ var buildChoices = function buildChoices(possibleResponseChoices, builtCategoryC
|
|
|
358
353
|
return acc;
|
|
359
354
|
}, {
|
|
360
355
|
builtChoices: [],
|
|
361
|
-
copyOfPossibleResponse:
|
|
356
|
+
copyOfPossibleResponse: (0, _toConsumableArray2["default"])(possibleResponseChoices),
|
|
362
357
|
allChoicesAreCorrect: true
|
|
363
358
|
});
|
|
364
359
|
};
|
|
@@ -386,7 +381,7 @@ var getBuiltCategories = function getBuiltCategories(possibleResponse, builtCate
|
|
|
386
381
|
allChoicesAreCorrect = _buildChoices.allChoicesAreCorrect;
|
|
387
382
|
|
|
388
383
|
var allChoicesAreInAnswer = builtCategoryChoices.length === possibleResponseChoices.length;
|
|
389
|
-
acc.builtCategories.push(_objectSpread({}, builtCategory, {
|
|
384
|
+
acc.builtCategories.push(_objectSpread(_objectSpread({}, builtCategory), {}, {
|
|
390
385
|
correct: allChoicesAreCorrect && allChoicesAreInAnswer,
|
|
391
386
|
choices: builtChoices
|
|
392
387
|
}));
|
|
@@ -418,7 +413,7 @@ var getAllPossibleResponses = function getAllPossibleResponses(correctResponse)
|
|
|
418
413
|
if (acc[0]) {
|
|
419
414
|
acc[0][cR.category] = cR.choices;
|
|
420
415
|
} else {
|
|
421
|
-
acc.push(
|
|
416
|
+
acc.push((0, _defineProperty2["default"])({}, cR.category, cR.choices));
|
|
422
417
|
} // alternate responses
|
|
423
418
|
|
|
424
419
|
|
|
@@ -427,7 +422,7 @@ var getAllPossibleResponses = function getAllPossibleResponses(correctResponse)
|
|
|
427
422
|
if (acc[index + 1]) {
|
|
428
423
|
acc[index + 1][cR.category] = aR;
|
|
429
424
|
} else {
|
|
430
|
-
acc.push(
|
|
425
|
+
acc.push((0, _defineProperty2["default"])({}, cR.category, aR));
|
|
431
426
|
}
|
|
432
427
|
});
|
|
433
428
|
}
|
|
@@ -462,7 +457,7 @@ var buildCategories = function buildCategories(categories, choices, answers) {
|
|
|
462
457
|
_ref$choices = _ref.choices,
|
|
463
458
|
answerChoices = _ref$choices === void 0 ? [] : _ref$choices;
|
|
464
459
|
|
|
465
|
-
return _objectSpread({}, category, {
|
|
460
|
+
return _objectSpread(_objectSpread({}, category), {}, {
|
|
466
461
|
choices: answerChoices.map(function (chId) {
|
|
467
462
|
return choices.find(function (ch) {
|
|
468
463
|
return ch.id === chId;
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["FooTwo","log","limitChoices","choiceId","count","choices","out","reduce","acc","id","foundCount","countInChoices","push","limitInArrays","arrays","limit","result","array","l","limitInArray","arr","stripped","filter","v","length","ensureNoExtraChoicesInAnswer","answer","answerArray","choice","categoryCount","undefined","map","a","updatedArray","r","index","category","alternateResponses","countInAnswer","c","countChosen","categories","Array","isArray","h","removeCategory","categoryId","answers","removeAllChoices","cloned","removeChoiceFromCategory","choiceIndex","findIndex","splice","moveChoiceToCategory","from","to","stillSelectable","builtCategories","buildChoices","possibleResponseChoices","builtCategoryChoices","builtChoice","copyOfPossibleResponse","cRC","builtChoices","correct","slice","allChoicesAreCorrect","getBuiltCategories","possibleResponse","builtCategory","allChoicesAreInAnswer","getAllPossibleResponses","correctResponse","cR","forEach","aR","buildCategories","find","answerChoices","chId","ch","buildState","allResponses","bestResponse","entirelyCorrect","builtData","categoriesWithChoices","filteredChoices","empty"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;AAIO,IAAMA,MAAM,GAAG,SAAf;;AAEP,IAAMC,GAAG,GAAG,uBAAM,qBAAN,CAAZ;;AACO,IAAMC,YAAY,GAAG,SAAfA,YAAe,CAACC,QAAD,EAAWC,KAAX,EAAkBC,OAAlB,EAA8B;AACxD,MAAMC,GAAG,GAAGD,OAAO,CAACE,MAAR,CACV,UAACC,GAAD,EAAMC,EAAN,EAAa;AACX,QAAMC,UAAU,GAAGC,cAAc,CAACR,QAAD,EAA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IAAAA,eAAe,GAAGC,SAAS,CAACD,eAA5B;AACD;;AAED,MAAMG,eAAe,GAAGpF,OAAO,CAAC0B,GAAR,CAAY,UAAAmD,EAAE;AAAA,WACpCzB,eAAe,CAACyB,EAAD,EAAKxB,eAAL,CAAf,GAAuCwB,EAAvC,GAA4C;AAAEQ,MAAAA,KAAK,EAAE;AAAT,KADR;AAAA,GAAd,CAAxB;AAIA,SAAO;AACLrF,IAAAA,OAAO,EAAEoF,eADJ;AAELhD,IAAAA,UAAU,EAAEiB,eAFP;AAGLQ,IAAAA,OAAO,EAAEoB,eAHJ;AAILD,IAAAA,YAAY,EAAZA;AAJK,GAAP;AAMD,CAtDM","sourcesContent":["import compact from 'lodash/compact';\nimport debug from 'debug';\nimport clone from 'lodash/clone';\nimport cloneDeep from 'lodash/cloneDeep';\nimport remove from 'lodash/remove';\nimport every from 'lodash/every';\nimport isEqual from 'lodash/isEqual';\nimport isUndefined from 'lodash/isUndefined';\nimport { score } from './scoring';\n\nexport { score };\n\nexport const FooTwo = 'foo-two';\n\nconst log = debug('@pie-lib:categorize');\nexport const limitChoices = (choiceId, count, choices) => {\n const out = choices.reduce(\n (acc, id) => {\n const foundCount = countInChoices(choiceId, acc.choices);\n // log('[limitChoices] choiceId: ', choiceId, ' foundCount: ', foundCount);\n if (id !== choiceId || foundCount < count) {\n acc.choices.push(id);\n }\n return acc;\n },\n { choices: [] }\n );\n\n return out.choices;\n};\n\n/**\n * Limit in an array of arrays.\n * So for an array with [[1,1],[1,1]] if you call limitInArray(1, arr, 3) you'll get: [[1,1], [1]]\n * @param {*} id\n * @param {*} arrays\n * @param {*} limit\n */\nexport const limitInArrays = (id, arrays, limit) => {\n arrays = arrays || [];\n\n const result = arrays.reduce(\n (acc, array) => {\n const l = limit - acc.count;\n const result = limitInArray(id, array, l);\n acc.out.push(result.array);\n acc.count = acc.count + (result.count || 0);\n return acc;\n },\n { out: [], count: 0 }\n );\n\n return result.out;\n};\n\n/**\n * Limit the id in the array to the limit set.\n * So for an array with [1,1,1,1] if you call limitInArray(1, arr, 2) you'll get: [1,1]\n * @param {string} id\n * @param {string[]} arr\n * @param {number} limit\n */\nexport const limitInArray = (id, arr, limit) => {\n arr = arr || [];\n\n if (limit === 0) {\n const stripped = arr.filter(v => v !== id);\n return { array: stripped, count: arr.length - stripped.length };\n } else {\n const result = arr.reduce(\n (acc, v) => {\n if (v === id) {\n if (acc.count < limit) {\n acc.count += 1;\n acc.out.push(v);\n }\n } else {\n acc.out.push(v);\n }\n return acc;\n },\n { out: [], count: 0 }\n );\n\n return { array: result.out, count: result.count };\n }\n};\n\n/**\n * Ensure that there are no extra choices in answer, if a choice.categoryCount is > 0.\n * @param {{category: string, choices: string[]}[]} answer\n * @param {{id:string,categoryCount:number}} choices\n */\nexport const ensureNoExtraChoicesInAnswer = (answer, choices) => {\n choices = choices || [];\n\n const out = choices.reduce((answerArray, choice) => {\n log('choice: ----> ', choice.id, 'categoryCount: ', choice.categoryCount);\n // log('answer array: ', answerArray);\n if (choice.categoryCount === undefined || choice.categoryCount === 0) {\n return answerArray;\n } else {\n const choices = answerArray.map(a => a.choices);\n const result = limitInArrays(choice.id, choices, choice.categoryCount);\n const updatedArray = result.map((r, index) => {\n return {\n category: answerArray[index].category,\n alternateResponses: answerArray[index].alternateResponses,\n choices: r\n };\n });\n return updatedArray;\n }\n }, answer);\n return out;\n};\n\n/**\n * Count the number of choice ids in a given answer array\n * @param {string} choiceId\n * @param {{category: string, choices: string[]}[]} answer\n */\nexport const countInAnswer = (choiceId, answer) => {\n const out = answer.reduce((acc, a) => acc + countInChoices(choiceId, a.choices), 0);\n log('[countInAnswer] choiceId:', choiceId, answer);\n return out;\n};\n\nexport const countInChoices = (choiceId, choices) =>\n (choices || []).filter(c => c === choiceId).length;\n\n/**\n * Count the number of times a choice has been selected in categories.\n * @param {*} choice\n * @param {*} categories\n */\nexport const countChosen = (choice, categories) => {\n if (!choice || !choice.id) {\n return 0;\n }\n\n if (!Array.isArray(categories)) {\n return 0;\n }\n\n return categories.reduce((acc, c) => {\n const count = (c.choices || []).filter(h => h.id === choice.id).length;\n return acc + count;\n }, 0);\n};\n\n/**\n * @param {string?} categoryId\n * @param {{category:string, choices: string[]}} answers\n */\nexport const removeCategory = (categoryId, answers) =>\n answers.filter(a => a.category !== categoryId);\n\n/**\n * @param {string} choiceId\n * @param {{category:string, choices: string[]}} answers\n * @param {string?} categoryId - optional categegory id\n */\nexport const removeAllChoices = (choiceId, answers, categoryId) => {\n return answers.map(a => {\n if (!categoryId || a.category === categoryId) {\n const cloned = clone(a.choices);\n remove(cloned, v => v === choiceId);\n return { ...a, choices: cloned };\n } else {\n return a;\n }\n });\n};\n\nexport const removeChoiceFromCategory = (choiceId, categoryId, choiceIndex, answers) => {\n log('[removeChoiceFromCategory] choiceIndex:', choiceIndex);\n\n return answers.map(a => {\n if (a.category === categoryId) {\n const cloned = clone(a.choices);\n const index = cloned.findIndex((v, index) => {\n return v === choiceId && index >= choiceIndex;\n });\n if (index !== -1) {\n cloned.splice(index, 1);\n }\n return { ...a, choices: cloned };\n } else {\n return a;\n }\n });\n};\n\nexport const moveChoiceToCategory = (choiceId, from, to, choiceIndex, answers) => {\n log(\n '[moveChoiceToCategory] choice: ',\n choiceId,\n 'from: ',\n from,\n 'to: ',\n to,\n 'answers: ',\n answers\n );\n\n if (from === to) {\n return answers;\n }\n\n if (from) {\n answers = removeChoiceFromCategory(choiceId, from, choiceIndex, answers);\n }\n\n const index = answers.findIndex(a => a.category === to);\n if (index === -1) {\n answers.push({ category: to, choices: [choiceId] });\n return answers;\n } else {\n return answers.map(a => {\n if (a.category === to) {\n a.choices = a.choices || [];\n a.choices.push(choiceId);\n return a;\n }\n return a;\n });\n }\n};\n\nexport const stillSelectable = (h, builtCategories) => {\n if (h.categoryCount > 0) {\n const count = countChosen(h, builtCategories);\n return count < h.categoryCount;\n } else {\n return true;\n }\n};\n\n/**\n * returns all choices with property 'correct' set to boolean\n * @param {string[]} possibleResponseChoices\n * @param {Object[]} builtCategoryChoices\n *\n * @returns {Object}, returns builtChoices: BuiltChoice[] and allChoicesAreCorrect: boolean\n * BuiltChoice = { id: choiceId, content: choiceContent, correct: boolean }\n */\nexport const buildChoices = (possibleResponseChoices, builtCategoryChoices) => {\n return builtCategoryChoices.reduce(\n (acc, builtChoice) => {\n // set correct value on each choice that was selected by user\n const index = acc.copyOfPossibleResponse.findIndex(cRC => cRC === builtChoice.id);\n // if the choice exists in the correct response\n // set the correct: true\n if (index >= 0) {\n acc.builtChoices.push({\n ...builtChoice,\n correct: true\n });\n acc.copyOfPossibleResponse = [\n ...acc.copyOfPossibleResponse.slice(0, index),\n ...acc.copyOfPossibleResponse.slice(index + 1)\n ];\n } else {\n acc.builtChoices.push({\n ...builtChoice,\n correct: false\n });\n acc.allChoicesAreCorrect = false;\n }\n\n return acc;\n },\n {\n builtChoices: [],\n copyOfPossibleResponse: [...possibleResponseChoices],\n allChoicesAreCorrect: true\n }\n );\n};\n\n/**\n * returns corrected answer using this possible correct response\n * @param {Object} possibleResponse, has form: { CategoryId: ChoiceId[] }\n * @param {Object[]} builtCategories\n *\n * @returns {Object}, returns builtCategories: BuiltCategory[] and correct: boolean\n * BuiltCategory = { id: categoryId, label: categoryLabel, correct: boolean, choices: BuiltChoice[] }\n * BuiltChoice = { id: choiceId, content: choiceContent, correct: boolean }\n */\nexport const getBuiltCategories = (possibleResponse, builtCategories) =>\n builtCategories.reduce(\n (acc, builtCategory) => {\n const possibleResponseChoices = possibleResponse[builtCategory.id] || []; // the correct choices for this category\n const builtCategoryChoices = builtCategory.choices || []; // the choices in the answer\n\n const { builtChoices, allChoicesAreCorrect } = buildChoices(\n possibleResponseChoices,\n builtCategoryChoices\n );\n const allChoicesAreInAnswer = builtCategoryChoices.length === possibleResponseChoices.length;\n\n acc.builtCategories.push({\n ...builtCategory,\n correct: allChoicesAreCorrect && allChoicesAreInAnswer,\n choices: builtChoices\n });\n acc.correct = acc.correct && allChoicesAreCorrect && allChoicesAreInAnswer;\n\n return acc;\n },\n { builtCategories: [], correct: true }\n );\n\n/**\n * returns all the possible responses by combining the proper alternate responses\n * @param {Object[]} correctResponse\n *\n * @returns {Object[]}, returns Response[]\n * Response = { CategoryId: ChoiceId[] },\n */\nexport const getAllPossibleResponses = correctResponse => {\n if (!correctResponse) {\n return [];\n }\n\n return correctResponse.reduce((acc, cR) => {\n // main response\n if (acc[0]) {\n acc[0][cR.category] = cR.choices;\n } else {\n acc.push({ [cR.category]: cR.choices });\n }\n\n // alternate responses\n if (cR.alternateResponses) {\n cR.alternateResponses.forEach((aR, index) => {\n if (acc[index + 1]) {\n acc[index + 1][cR.category] = aR;\n } else {\n acc.push({ [cR.category]: aR });\n }\n });\n }\n\n return acc;\n }, []);\n};\n\n/**\n * build the categories to be displayed, where each category has its own list of choices\n * @param {Object[]} categories\n * @param {{id:string}[]} choices\n * @param {{category: string, choices:string[]}[]} answers\n *\n * @returns {Object[]}, returns BuiltCategory[]\n * BuiltCategory = { id: categoryId, label: categoryLabel, choices: BuiltChoice[]},\n * BuiltChoice = { id: choiceId, content: choiceContent }\n */\nexport const buildCategories = (categories, choices, answers) => {\n categories = categories || [];\n answers = answers || [];\n choices = choices || [];\n\n return categories.map(category => {\n const answer = answers.find(answer => answer.category === category.id);\n const { choices: answerChoices = [] } = answer || {};\n\n return {\n ...category,\n choices: answerChoices.map(chId => choices.find(ch => ch.id === chId))\n };\n });\n};\n\n/**\n * build the choice and category state\n * @param {Object[]} categories\n * @param {{id:string}[]} choices\n * @param {{category: string, choices:string[]}[]} answers\n *\n * @param correctResponse\n * @returns { categories: Category[], choices: Choice[], correct: boolean, bestResponse: Response }, where Response: { categoryId: choiceId[] }\n */\nexport const buildState = (categories, choices, answers, correctResponse) => {\n categories = categories || [];\n choices = choices || [];\n answers = answers || [];\n\n const allResponses = getAllPossibleResponses(correctResponse) || [];\n\n let builtCategories = buildCategories(categories, choices, answers);\n let bestResponse;\n let entirelyCorrect;\n\n // at least one defined correct response\n if (allResponses.length) {\n const builtData = allResponses.reduce(\n (acc, possibleResponse) => {\n // set correctness for each possible response\n const { builtCategories: categoriesWithChoices, correct } = getBuiltCategories(\n possibleResponse,\n builtCategories\n );\n\n // if bestResponse not found yet OR no correct response found yet and this one is the correct one\n if (acc.bestResponse === null || (!acc.entirelyCorrect && correct)) {\n return {\n bestResponse: possibleResponse,\n builtCategories: categoriesWithChoices,\n entirelyCorrect: correct\n };\n }\n\n return acc;\n },\n {\n bestResponse: null,\n builtCategories: [],\n entirelyCorrect: false\n }\n );\n\n builtCategories = builtData.builtCategories;\n bestResponse = builtData.bestResponse;\n entirelyCorrect = builtData.entirelyCorrect;\n }\n\n const filteredChoices = choices.map(ch =>\n stillSelectable(ch, builtCategories) ? ch : { empty: true }\n );\n\n return {\n choices: filteredChoices,\n categories: builtCategories,\n correct: entirelyCorrect,\n bestResponse\n };\n};\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["FooTwo","log","limitChoices","choiceId","count","choices","out","reduce","acc","id","foundCount","countInChoices","push","limitInArrays","arrays","limit","result","array","l","limitInArray","arr","stripped","filter","v","length","ensureNoExtraChoicesInAnswer","answer","answerArray","choice","categoryCount","undefined","map","a","updatedArray","r","index","category","alternateResponses","countInAnswer","c","countChosen","categories","Array","isArray","h","removeCategory","categoryId","answers","removeAllChoices","cloned","removeChoiceFromCategory","choiceIndex","findIndex","splice","moveChoiceToCategory","from","to","stillSelectable","builtCategories","buildChoices","possibleResponseChoices","builtCategoryChoices","builtChoice","copyOfPossibleResponse","cRC","builtChoices","correct","slice","allChoicesAreCorrect","getBuiltCategories","possibleResponse","builtCategory","allChoicesAreInAnswer","getAllPossibleResponses","correctResponse","cR","forEach","aR","buildCategories","find","answerChoices","chId","ch","buildState","allResponses","bestResponse","entirelyCorrect","builtData","categoriesWithChoices","filteredChoices","empty"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAIO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,uBAAgDA,OAAhD,CAFyB,CAOzB;;;AACA,UAAI1D,GAAG,CAAC6E,YAAJ,KAAqB,IAArB,IAA8B,CAAC7E,GAAG,CAAC8E,eAAL,IAAwBpB,OAA1D,EAAoE;AAClE,eAAO;AACLmB,UAAAA,YAAY,EAAEf,gBADT;AAELZ,UAAAA,eAAe,EAAE8B,qBAFZ;AAGLF,UAAAA,eAAe,EAAEpB;AAHZ,SAAP;AAKD;;AAED,aAAO1D,GAAP;AACD,KAlBe,EAmBhB;AACE6E,MAAAA,YAAY,EAAE,IADhB;AAEE3B,MAAAA,eAAe,EAAE,EAFnB;AAGE4B,MAAAA,eAAe,EAAE;AAHnB,KAnBgB,CAAlB;AA0BA5B,IAAAA,eAAe,GAAG6B,SAAS,CAAC7B,eAA5B;AACA2B,IAAAA,YAAY,GAAGE,SAAS,CAACF,YAAzB;AACAC,IAAAA,eAAe,GAAGC,SAAS,CAACD,eAA5B;AACD;;AAED,MAAMG,eAAe,GAAGpF,OAAO,CAAC0B,GAAR,CAAY,UAACmD,EAAD;AAAA,WAASzB,eAAe,CAACyB,EAAD,EAAKxB,eAAL,CAAf,GAAuCwB,EAAvC,GAA4C;AAAEQ,MAAAA,KAAK,EAAE;AAAT,KAArD;AAAA,GAAZ,CAAxB;AAEA,SAAO;AACLrF,IAAAA,OAAO,EAAEoF,eADJ;AAELhD,IAAAA,UAAU,EAAEiB,eAFP;AAGLQ,IAAAA,OAAO,EAAEoB,eAHJ;AAILD,IAAAA,YAAY,EAAZA;AAJK,GAAP;AAMD,CApDM","sourcesContent":["import compact from 'lodash/compact';\nimport debug from 'debug';\nimport clone from 'lodash/clone';\nimport cloneDeep from 'lodash/cloneDeep';\nimport remove from 'lodash/remove';\nimport every from 'lodash/every';\nimport isEqual from 'lodash/isEqual';\nimport isUndefined from 'lodash/isUndefined';\nimport { score } from './scoring';\n\nexport { score };\n\nexport const FooTwo = 'foo-two';\n\nconst log = debug('@pie-lib:categorize');\nexport const limitChoices = (choiceId, count, choices) => {\n const out = choices.reduce(\n (acc, id) => {\n const foundCount = countInChoices(choiceId, acc.choices);\n // log('[limitChoices] choiceId: ', choiceId, ' foundCount: ', foundCount);\n if (id !== choiceId || foundCount < count) {\n acc.choices.push(id);\n }\n return acc;\n },\n { choices: [] },\n );\n\n return out.choices;\n};\n\n/**\n * Limit in an array of arrays.\n * So for an array with [[1,1],[1,1]] if you call limitInArray(1, arr, 3) you'll get: [[1,1], [1]]\n * @param {*} id\n * @param {*} arrays\n * @param {*} limit\n */\nexport const limitInArrays = (id, arrays, limit) => {\n arrays = arrays || [];\n\n const result = arrays.reduce(\n (acc, array) => {\n const l = limit - acc.count;\n const result = limitInArray(id, array, l);\n acc.out.push(result.array);\n acc.count = acc.count + (result.count || 0);\n return acc;\n },\n { out: [], count: 0 },\n );\n\n return result.out;\n};\n\n/**\n * Limit the id in the array to the limit set.\n * So for an array with [1,1,1,1] if you call limitInArray(1, arr, 2) you'll get: [1,1]\n * @param {string} id\n * @param {string[]} arr\n * @param {number} limit\n */\nexport const limitInArray = (id, arr, limit) => {\n arr = arr || [];\n\n if (limit === 0) {\n const stripped = arr.filter((v) => v !== id);\n return { array: stripped, count: arr.length - stripped.length };\n } else {\n const result = arr.reduce(\n (acc, v) => {\n if (v === id) {\n if (acc.count < limit) {\n acc.count += 1;\n acc.out.push(v);\n }\n } else {\n acc.out.push(v);\n }\n return acc;\n },\n { out: [], count: 0 },\n );\n\n return { array: result.out, count: result.count };\n }\n};\n\n/**\n * Ensure that there are no extra choices in answer, if a choice.categoryCount is > 0.\n * @param {{category: string, choices: string[]}[]} answer\n * @param {{id:string,categoryCount:number}} choices\n */\nexport const ensureNoExtraChoicesInAnswer = (answer, choices) => {\n choices = choices || [];\n\n const out = choices.reduce((answerArray, choice) => {\n log('choice: ----> ', choice.id, 'categoryCount: ', choice.categoryCount);\n // log('answer array: ', answerArray);\n if (choice.categoryCount === undefined || choice.categoryCount === 0) {\n return answerArray;\n } else {\n const choices = answerArray.map((a) => a.choices);\n const result = limitInArrays(choice.id, choices, choice.categoryCount);\n const updatedArray = result.map((r, index) => {\n return {\n category: answerArray[index].category,\n alternateResponses: answerArray[index].alternateResponses,\n choices: r,\n };\n });\n return updatedArray;\n }\n }, answer);\n return out;\n};\n\n/**\n * Count the number of choice ids in a given answer array\n * @param {string} choiceId\n * @param {{category: string, choices: string[]}[]} answer\n */\nexport const countInAnswer = (choiceId, answer) => {\n const out = answer.reduce((acc, a) => acc + countInChoices(choiceId, a.choices), 0);\n log('[countInAnswer] choiceId:', choiceId, answer);\n return out;\n};\n\nexport const countInChoices = (choiceId, choices) => (choices || []).filter((c) => c === choiceId).length;\n\n/**\n * Count the number of times a choice has been selected in categories.\n * @param {*} choice\n * @param {*} categories\n */\nexport const countChosen = (choice, categories) => {\n if (!choice || !choice.id) {\n return 0;\n }\n\n if (!Array.isArray(categories)) {\n return 0;\n }\n\n return categories.reduce((acc, c) => {\n const count = (c.choices || []).filter((h) => h.id === choice.id).length;\n return acc + count;\n }, 0);\n};\n\n/**\n * @param {string?} categoryId\n * @param {{category:string, choices: string[]}} answers\n */\nexport const removeCategory = (categoryId, answers) => answers.filter((a) => a.category !== categoryId);\n\n/**\n * @param {string} choiceId\n * @param {{category:string, choices: string[]}} answers\n * @param {string?} categoryId - optional categegory id\n */\nexport const removeAllChoices = (choiceId, answers, categoryId) => {\n return answers.map((a) => {\n if (!categoryId || a.category === categoryId) {\n const cloned = clone(a.choices);\n remove(cloned, (v) => v === choiceId);\n return { ...a, choices: cloned };\n } else {\n return a;\n }\n });\n};\n\nexport const removeChoiceFromCategory = (choiceId, categoryId, choiceIndex, answers) => {\n log('[removeChoiceFromCategory] choiceIndex:', choiceIndex);\n\n return answers.map((a) => {\n if (a.category === categoryId) {\n const cloned = clone(a.choices);\n const index = cloned.findIndex((v, index) => {\n return v === choiceId && index >= choiceIndex;\n });\n if (index !== -1) {\n cloned.splice(index, 1);\n }\n return { ...a, choices: cloned };\n } else {\n return a;\n }\n });\n};\n\nexport const moveChoiceToCategory = (choiceId, from, to, choiceIndex, answers) => {\n log('[moveChoiceToCategory] choice: ', choiceId, 'from: ', from, 'to: ', to, 'answers: ', answers);\n\n if (from === to) {\n return answers;\n }\n\n if (from) {\n answers = removeChoiceFromCategory(choiceId, from, choiceIndex, answers);\n }\n\n const index = answers.findIndex((a) => a.category === to);\n if (index === -1) {\n answers.push({ category: to, choices: [choiceId] });\n return answers;\n } else {\n return answers.map((a) => {\n if (a.category === to) {\n a.choices = a.choices || [];\n a.choices.push(choiceId);\n return a;\n }\n return a;\n });\n }\n};\n\nexport const stillSelectable = (h, builtCategories) => {\n if (h.categoryCount > 0) {\n const count = countChosen(h, builtCategories);\n return count < h.categoryCount;\n } else {\n return true;\n }\n};\n\n/**\n * returns all choices with property 'correct' set to boolean\n * @param {string[]} possibleResponseChoices\n * @param {Object[]} builtCategoryChoices\n *\n * @returns {Object}, returns builtChoices: BuiltChoice[] and allChoicesAreCorrect: boolean\n * BuiltChoice = { id: choiceId, content: choiceContent, correct: boolean }\n */\nexport const buildChoices = (possibleResponseChoices, builtCategoryChoices) => {\n return builtCategoryChoices.reduce(\n (acc, builtChoice) => {\n // set correct value on each choice that was selected by user\n const index = acc.copyOfPossibleResponse.findIndex((cRC) => cRC === builtChoice.id);\n // if the choice exists in the correct response\n // set the correct: true\n if (index >= 0) {\n acc.builtChoices.push({\n ...builtChoice,\n correct: true,\n });\n acc.copyOfPossibleResponse = [\n ...acc.copyOfPossibleResponse.slice(0, index),\n ...acc.copyOfPossibleResponse.slice(index + 1),\n ];\n } else {\n acc.builtChoices.push({\n ...builtChoice,\n correct: false,\n });\n acc.allChoicesAreCorrect = false;\n }\n\n return acc;\n },\n {\n builtChoices: [],\n copyOfPossibleResponse: [...possibleResponseChoices],\n allChoicesAreCorrect: true,\n },\n );\n};\n\n/**\n * returns corrected answer using this possible correct response\n * @param {Object} possibleResponse, has form: { CategoryId: ChoiceId[] }\n * @param {Object[]} builtCategories\n *\n * @returns {Object}, returns builtCategories: BuiltCategory[] and correct: boolean\n * BuiltCategory = { id: categoryId, label: categoryLabel, correct: boolean, choices: BuiltChoice[] }\n * BuiltChoice = { id: choiceId, content: choiceContent, correct: boolean }\n */\nexport const getBuiltCategories = (possibleResponse, builtCategories) =>\n builtCategories.reduce(\n (acc, builtCategory) => {\n const possibleResponseChoices = possibleResponse[builtCategory.id] || []; // the correct choices for this category\n const builtCategoryChoices = builtCategory.choices || []; // the choices in the answer\n\n const { builtChoices, allChoicesAreCorrect } = buildChoices(possibleResponseChoices, builtCategoryChoices);\n const allChoicesAreInAnswer = builtCategoryChoices.length === possibleResponseChoices.length;\n\n acc.builtCategories.push({\n ...builtCategory,\n correct: allChoicesAreCorrect && allChoicesAreInAnswer,\n choices: builtChoices,\n });\n acc.correct = acc.correct && allChoicesAreCorrect && allChoicesAreInAnswer;\n\n return acc;\n },\n { builtCategories: [], correct: true },\n );\n\n/**\n * returns all the possible responses by combining the proper alternate responses\n * @param {Object[]} correctResponse\n *\n * @returns {Object[]}, returns Response[]\n * Response = { CategoryId: ChoiceId[] },\n */\nexport const getAllPossibleResponses = (correctResponse) => {\n if (!correctResponse) {\n return [];\n }\n\n return correctResponse.reduce((acc, cR) => {\n // main response\n if (acc[0]) {\n acc[0][cR.category] = cR.choices;\n } else {\n acc.push({ [cR.category]: cR.choices });\n }\n\n // alternate responses\n if (cR.alternateResponses) {\n cR.alternateResponses.forEach((aR, index) => {\n if (acc[index + 1]) {\n acc[index + 1][cR.category] = aR;\n } else {\n acc.push({ [cR.category]: aR });\n }\n });\n }\n\n return acc;\n }, []);\n};\n\n/**\n * build the categories to be displayed, where each category has its own list of choices\n * @param {Object[]} categories\n * @param {{id:string}[]} choices\n * @param {{category: string, choices:string[]}[]} answers\n *\n * @returns {Object[]}, returns BuiltCategory[]\n * BuiltCategory = { id: categoryId, label: categoryLabel, choices: BuiltChoice[]},\n * BuiltChoice = { id: choiceId, content: choiceContent }\n */\nexport const buildCategories = (categories, choices, answers) => {\n categories = categories || [];\n answers = answers || [];\n choices = choices || [];\n\n return categories.map((category) => {\n const answer = answers.find((answer) => answer.category === category.id);\n const { choices: answerChoices = [] } = answer || {};\n\n return {\n ...category,\n choices: answerChoices.map((chId) => choices.find((ch) => ch.id === chId)),\n };\n });\n};\n\n/**\n * build the choice and category state\n * @param {Object[]} categories\n * @param {{id:string}[]} choices\n * @param {{category: string, choices:string[]}[]} answers\n *\n * @param correctResponse\n * @returns { categories: Category[], choices: Choice[], correct: boolean, bestResponse: Response }, where Response: { categoryId: choiceId[] }\n */\nexport const buildState = (categories, choices, answers, correctResponse) => {\n categories = categories || [];\n choices = choices || [];\n answers = answers || [];\n\n const allResponses = getAllPossibleResponses(correctResponse) || [];\n\n let builtCategories = buildCategories(categories, choices, answers);\n let bestResponse;\n let entirelyCorrect;\n\n // at least one defined correct response\n if (allResponses.length) {\n const builtData = allResponses.reduce(\n (acc, possibleResponse) => {\n // set correctness for each possible response\n const { builtCategories: categoriesWithChoices, correct } = getBuiltCategories(\n possibleResponse,\n builtCategories,\n );\n\n // if bestResponse not found yet OR no correct response found yet and this one is the correct one\n if (acc.bestResponse === null || (!acc.entirelyCorrect && correct)) {\n return {\n bestResponse: possibleResponse,\n builtCategories: categoriesWithChoices,\n entirelyCorrect: correct,\n };\n }\n\n return acc;\n },\n {\n bestResponse: null,\n builtCategories: [],\n entirelyCorrect: false,\n },\n );\n\n builtCategories = builtData.builtCategories;\n bestResponse = builtData.bestResponse;\n entirelyCorrect = builtData.entirelyCorrect;\n }\n\n const filteredChoices = choices.map((ch) => (stillSelectable(ch, builtCategories) ? ch : { empty: true }));\n\n return {\n choices: filteredChoices,\n categories: builtCategories,\n correct: entirelyCorrect,\n bestResponse,\n };\n};\n"],"file":"index.js"}
|
package/lib/scoring.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports.score = void 0;
|
|
7
9
|
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
var _debug = _interopRequireDefault(require("debug"));
|
|
13
13
|
|
|
14
|
-
function
|
|
14
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
15
15
|
|
|
16
|
-
function
|
|
16
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
17
17
|
|
|
18
18
|
var log = (0, _debug["default"])('@pie-lib:categorize:scoring');
|
|
19
19
|
|
|
@@ -61,7 +61,7 @@ var score = function score(categories, scoring) {
|
|
|
61
61
|
}) || {
|
|
62
62
|
points: 1
|
|
63
63
|
};
|
|
64
|
-
return _objectSpread({}, r, {
|
|
64
|
+
return _objectSpread(_objectSpread({}, r), {}, {
|
|
65
65
|
category: c.id
|
|
66
66
|
});
|
|
67
67
|
});
|
package/lib/scoring.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/scoring.js"],"names":["log","getWeightingRules","scoring","weighting","enabled","rules","getPartialRulesForCategory","partial","categoryId","pr","find","category","score","categories","Promise","resolve","weightingRules","weights","map","c","r","id","points","weightTotal","reduce","total","withScore","w","correct","correctCount","choices","filter","h","length","rule","u","count","percent","correctChoices","weightedScore","sum","parseFloat","toFixed","details","weighted"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/scoring.js"],"names":["log","getWeightingRules","scoring","weighting","enabled","rules","getPartialRulesForCategory","partial","categoryId","pr","find","category","score","categories","Promise","resolve","weightingRules","weights","map","c","r","id","points","weightTotal","reduce","total","withScore","w","correct","correctCount","choices","filter","h","length","rule","u","count","percent","correctChoices","weightedScore","sum","parseFloat","toFixed","details","weighted"],"mappings":";;;;;;;;;;;AAAA;;;;;;AACA,IAAMA,GAAG,GAAG,uBAAM,6BAAN,CAAZ;;AACA,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,OAAD,EAAa;AACrC,MAAI,CAACA,OAAD,IAAY,CAACA,OAAO,CAACC,SAAzB,EAAoC;AAClC,WAAO,EAAP;AACD,GAFD,MAEO;AACL,QAAI,CAACD,OAAO,CAACC,SAAR,CAAkBC,OAAvB,EAAgC;AAC9B,aAAO,EAAP;AACD,KAFD,MAEO;AACL,UAAMC,KAAK,GAAGH,OAAO,CAACC,SAAR,GAAoBD,OAAO,CAACC,SAAR,CAAkBE,KAAlB,IAA2B,EAA/C,GAAoD,EAAlE;AACA,aAAOA,KAAP;AACD;AACF;AACF,CAXD;;AAaA,IAAMC,0BAA0B,GAAG,SAA7BA,0BAA6B,CAACC,OAAD,EAAUC,UAAV,EAAyB;AAC1DR,EAAAA,GAAG,CAAC,WAAD,EAAcO,OAAd,CAAH;;AACA,MAAI,CAACA,OAAD,IAAY,CAACA,OAAO,CAACH,OAAzB,EAAkC;AAChC;AACD,GAFD,MAEO;AACL,QAAMK,EAAE,GAAGF,OAAO,CAACF,KAAR,CAAcK,IAAd,CAAmB,UAACD,EAAD;AAAA,aAAQA,EAAE,CAACE,QAAH,KAAgBH,UAAxB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AAMjB,MAAK,GAAGe,CAAC,IAAIO,IAAI,CAACG,OAAL,GAAe,GAAnB,CAAf;;AACA,iBAAO;AACL1B,YAAAA,QAAQ,EAAEQ,CAAC,CAACE,EADP;AAELT,YAAAA,KAAK,EAALA,MAFK;AAGLU,YAAAA,MAAM,EAAEK,CAHH;AAILpB,YAAAA,OAAO,EAAE;AACP+B,cAAAA,cAAc,EAAET,YADT;AAEPK,cAAAA,IAAI,EAAEA;AAFC;AAJJ,WAAP;AASD;AACF;AACF,KA7BiB,CAAlB;AA+BA,QAAMK,aAAa,GAAGb,SAAS,CAACF,MAAV,CAAiB,UAACgB,GAAD,EAAMrB,CAAN,EAAY;AACjD,aAAQqB,GAAG,IAAIrB,CAAC,CAACP,KAAjB;AACD,KAFqB,EAEnB,CAFmB,CAAtB;AAIAZ,IAAAA,GAAG,CAAC,iBAAD,EAAoBuC,aAApB,CAAH;AAEA,QAAM3B,KAAK,GAAG6B,UAAU,CAAC,CAACF,aAAa,GAAGhB,WAAjB,EAA8BmB,OAA9B,CAAsC,CAAtC,CAAD,EAA2C,EAA3C,CAAxB;AACA3B,IAAAA,OAAO,CAAC;AACNH,MAAAA,KAAK,EAALA,KADM;AAEN+B,MAAAA,OAAO,EAAE;AACPC,QAAAA,QAAQ,EAAE;AACRnB,UAAAA,KAAK,EAAEF,WADC;AAERX,UAAAA,KAAK,EAAE2B;AAFC,SADH;AAKP1B,QAAAA,UAAU,EAAEa;AALL;AAFH,KAAD,CAAP;AAUD,GAlED,CADmB;AAAA,CAAd","sourcesContent":["import debug from 'debug';\nconst log = debug('@pie-lib:categorize:scoring');\nconst getWeightingRules = (scoring) => {\n if (!scoring || !scoring.weighting) {\n return [];\n } else {\n if (!scoring.weighting.enabled) {\n return [];\n } else {\n const rules = scoring.weighting ? scoring.weighting.rules || [] : [];\n return rules;\n }\n }\n};\n\nconst getPartialRulesForCategory = (partial, categoryId) => {\n log('partial? ', partial);\n if (!partial || !partial.enabled) {\n return;\n } else {\n const pr = partial.rules.find((pr) => pr.category === categoryId);\n return pr ? pr.rules || [] : [];\n }\n};\n\n/**\n *\n * Calculate score based on the categories model generated from `buildState` and the partial scoring rules.\n * @param {*} categories - this is the categories that you get from `buildState`.\n * @param {*} scoring - scoring config.\n * @see ../index#buildState\n */\n\nexport const score = (categories, scoring) =>\n new Promise((resolve) => {\n log('categories: ', categories, 'scoring: ', scoring);\n const weightingRules = getWeightingRules(scoring);\n\n const weights = categories.map((c) => {\n const r = weightingRules.find((r) => r.category === c.id) || { points: 1 };\n return { ...r, category: c.id };\n });\n\n log('weights: ', weights);\n\n const weightTotal = categories.reduce((total, c) => {\n const r = weights.find((r) => r.category === c.id);\n return (total += r.points);\n }, 0);\n\n log('total: ', weightTotal);\n\n const withScore = categories.map((c) => {\n const w = weights.find((r) => r.category === c.id).points;\n\n log('category: ', c);\n if (c.correct === true) {\n return { category: c.id, score: w, points: w };\n } else {\n const rules = getPartialRulesForCategory(scoring.partial, c.id);\n log('partial rules for category: ', rules);\n if (!rules) {\n return { category: c.id, score: 0, points: w };\n } else {\n const correctCount = (c.choices || []).filter((h) => h.correct).length;\n log('correctCount: ', correctCount);\n let rule = rules.find((u) => u.count === correctCount);\n log('rule: ', rule);\n rule = rule || { percent: 0, count: correctCount };\n const score = w * (rule.percent / 100);\n return {\n category: c.id,\n score,\n points: w,\n partial: {\n correctChoices: correctCount,\n rule: rule,\n },\n };\n }\n }\n });\n\n const weightedScore = withScore.reduce((sum, c) => {\n return (sum += c.score);\n }, 0);\n\n log('weightedScore: ', weightedScore);\n\n const score = parseFloat((weightedScore / weightTotal).toFixed(2), 10);\n resolve({\n score,\n details: {\n weighted: {\n total: weightTotal,\n score: weightedScore,\n },\n categories: withScore,\n },\n });\n });\n"],"file":"scoring.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-lib/categorize",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.25",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
"scripts": {},
|
|
15
15
|
"author": "",
|
|
16
16
|
"license": "ISC",
|
|
17
|
-
"gitHead": "
|
|
17
|
+
"gitHead": "f81076118e63884db5f5d65a41cff9aad111137e"
|
|
18
18
|
}
|
package/src/index.js
CHANGED
|
@@ -23,7 +23,7 @@ export const limitChoices = (choiceId, count, choices) => {
|
|
|
23
23
|
}
|
|
24
24
|
return acc;
|
|
25
25
|
},
|
|
26
|
-
{ choices: [] }
|
|
26
|
+
{ choices: [] },
|
|
27
27
|
);
|
|
28
28
|
|
|
29
29
|
return out.choices;
|
|
@@ -47,7 +47,7 @@ export const limitInArrays = (id, arrays, limit) => {
|
|
|
47
47
|
acc.count = acc.count + (result.count || 0);
|
|
48
48
|
return acc;
|
|
49
49
|
},
|
|
50
|
-
{ out: [], count: 0 }
|
|
50
|
+
{ out: [], count: 0 },
|
|
51
51
|
);
|
|
52
52
|
|
|
53
53
|
return result.out;
|
|
@@ -64,7 +64,7 @@ export const limitInArray = (id, arr, limit) => {
|
|
|
64
64
|
arr = arr || [];
|
|
65
65
|
|
|
66
66
|
if (limit === 0) {
|
|
67
|
-
const stripped = arr.filter(v => v !== id);
|
|
67
|
+
const stripped = arr.filter((v) => v !== id);
|
|
68
68
|
return { array: stripped, count: arr.length - stripped.length };
|
|
69
69
|
} else {
|
|
70
70
|
const result = arr.reduce(
|
|
@@ -79,7 +79,7 @@ export const limitInArray = (id, arr, limit) => {
|
|
|
79
79
|
}
|
|
80
80
|
return acc;
|
|
81
81
|
},
|
|
82
|
-
{ out: [], count: 0 }
|
|
82
|
+
{ out: [], count: 0 },
|
|
83
83
|
);
|
|
84
84
|
|
|
85
85
|
return { array: result.out, count: result.count };
|
|
@@ -100,13 +100,13 @@ export const ensureNoExtraChoicesInAnswer = (answer, choices) => {
|
|
|
100
100
|
if (choice.categoryCount === undefined || choice.categoryCount === 0) {
|
|
101
101
|
return answerArray;
|
|
102
102
|
} else {
|
|
103
|
-
const choices = answerArray.map(a => a.choices);
|
|
103
|
+
const choices = answerArray.map((a) => a.choices);
|
|
104
104
|
const result = limitInArrays(choice.id, choices, choice.categoryCount);
|
|
105
105
|
const updatedArray = result.map((r, index) => {
|
|
106
106
|
return {
|
|
107
107
|
category: answerArray[index].category,
|
|
108
108
|
alternateResponses: answerArray[index].alternateResponses,
|
|
109
|
-
choices: r
|
|
109
|
+
choices: r,
|
|
110
110
|
};
|
|
111
111
|
});
|
|
112
112
|
return updatedArray;
|
|
@@ -126,8 +126,7 @@ export const countInAnswer = (choiceId, answer) => {
|
|
|
126
126
|
return out;
|
|
127
127
|
};
|
|
128
128
|
|
|
129
|
-
export const countInChoices = (choiceId, choices) =>
|
|
130
|
-
(choices || []).filter(c => c === choiceId).length;
|
|
129
|
+
export const countInChoices = (choiceId, choices) => (choices || []).filter((c) => c === choiceId).length;
|
|
131
130
|
|
|
132
131
|
/**
|
|
133
132
|
* Count the number of times a choice has been selected in categories.
|
|
@@ -144,7 +143,7 @@ export const countChosen = (choice, categories) => {
|
|
|
144
143
|
}
|
|
145
144
|
|
|
146
145
|
return categories.reduce((acc, c) => {
|
|
147
|
-
const count = (c.choices || []).filter(h => h.id === choice.id).length;
|
|
146
|
+
const count = (c.choices || []).filter((h) => h.id === choice.id).length;
|
|
148
147
|
return acc + count;
|
|
149
148
|
}, 0);
|
|
150
149
|
};
|
|
@@ -153,8 +152,7 @@ export const countChosen = (choice, categories) => {
|
|
|
153
152
|
* @param {string?} categoryId
|
|
154
153
|
* @param {{category:string, choices: string[]}} answers
|
|
155
154
|
*/
|
|
156
|
-
export const removeCategory = (categoryId, answers) =>
|
|
157
|
-
answers.filter(a => a.category !== categoryId);
|
|
155
|
+
export const removeCategory = (categoryId, answers) => answers.filter((a) => a.category !== categoryId);
|
|
158
156
|
|
|
159
157
|
/**
|
|
160
158
|
* @param {string} choiceId
|
|
@@ -162,10 +160,10 @@ export const removeCategory = (categoryId, answers) =>
|
|
|
162
160
|
* @param {string?} categoryId - optional categegory id
|
|
163
161
|
*/
|
|
164
162
|
export const removeAllChoices = (choiceId, answers, categoryId) => {
|
|
165
|
-
return answers.map(a => {
|
|
163
|
+
return answers.map((a) => {
|
|
166
164
|
if (!categoryId || a.category === categoryId) {
|
|
167
165
|
const cloned = clone(a.choices);
|
|
168
|
-
remove(cloned, v => v === choiceId);
|
|
166
|
+
remove(cloned, (v) => v === choiceId);
|
|
169
167
|
return { ...a, choices: cloned };
|
|
170
168
|
} else {
|
|
171
169
|
return a;
|
|
@@ -176,7 +174,7 @@ export const removeAllChoices = (choiceId, answers, categoryId) => {
|
|
|
176
174
|
export const removeChoiceFromCategory = (choiceId, categoryId, choiceIndex, answers) => {
|
|
177
175
|
log('[removeChoiceFromCategory] choiceIndex:', choiceIndex);
|
|
178
176
|
|
|
179
|
-
return answers.map(a => {
|
|
177
|
+
return answers.map((a) => {
|
|
180
178
|
if (a.category === categoryId) {
|
|
181
179
|
const cloned = clone(a.choices);
|
|
182
180
|
const index = cloned.findIndex((v, index) => {
|
|
@@ -193,16 +191,7 @@ export const removeChoiceFromCategory = (choiceId, categoryId, choiceIndex, answ
|
|
|
193
191
|
};
|
|
194
192
|
|
|
195
193
|
export const moveChoiceToCategory = (choiceId, from, to, choiceIndex, answers) => {
|
|
196
|
-
log(
|
|
197
|
-
'[moveChoiceToCategory] choice: ',
|
|
198
|
-
choiceId,
|
|
199
|
-
'from: ',
|
|
200
|
-
from,
|
|
201
|
-
'to: ',
|
|
202
|
-
to,
|
|
203
|
-
'answers: ',
|
|
204
|
-
answers
|
|
205
|
-
);
|
|
194
|
+
log('[moveChoiceToCategory] choice: ', choiceId, 'from: ', from, 'to: ', to, 'answers: ', answers);
|
|
206
195
|
|
|
207
196
|
if (from === to) {
|
|
208
197
|
return answers;
|
|
@@ -212,12 +201,12 @@ export const moveChoiceToCategory = (choiceId, from, to, choiceIndex, answers) =
|
|
|
212
201
|
answers = removeChoiceFromCategory(choiceId, from, choiceIndex, answers);
|
|
213
202
|
}
|
|
214
203
|
|
|
215
|
-
const index = answers.findIndex(a => a.category === to);
|
|
204
|
+
const index = answers.findIndex((a) => a.category === to);
|
|
216
205
|
if (index === -1) {
|
|
217
206
|
answers.push({ category: to, choices: [choiceId] });
|
|
218
207
|
return answers;
|
|
219
208
|
} else {
|
|
220
|
-
return answers.map(a => {
|
|
209
|
+
return answers.map((a) => {
|
|
221
210
|
if (a.category === to) {
|
|
222
211
|
a.choices = a.choices || [];
|
|
223
212
|
a.choices.push(choiceId);
|
|
@@ -249,22 +238,22 @@ export const buildChoices = (possibleResponseChoices, builtCategoryChoices) => {
|
|
|
249
238
|
return builtCategoryChoices.reduce(
|
|
250
239
|
(acc, builtChoice) => {
|
|
251
240
|
// set correct value on each choice that was selected by user
|
|
252
|
-
const index = acc.copyOfPossibleResponse.findIndex(cRC => cRC === builtChoice.id);
|
|
241
|
+
const index = acc.copyOfPossibleResponse.findIndex((cRC) => cRC === builtChoice.id);
|
|
253
242
|
// if the choice exists in the correct response
|
|
254
243
|
// set the correct: true
|
|
255
244
|
if (index >= 0) {
|
|
256
245
|
acc.builtChoices.push({
|
|
257
246
|
...builtChoice,
|
|
258
|
-
correct: true
|
|
247
|
+
correct: true,
|
|
259
248
|
});
|
|
260
249
|
acc.copyOfPossibleResponse = [
|
|
261
250
|
...acc.copyOfPossibleResponse.slice(0, index),
|
|
262
|
-
...acc.copyOfPossibleResponse.slice(index + 1)
|
|
251
|
+
...acc.copyOfPossibleResponse.slice(index + 1),
|
|
263
252
|
];
|
|
264
253
|
} else {
|
|
265
254
|
acc.builtChoices.push({
|
|
266
255
|
...builtChoice,
|
|
267
|
-
correct: false
|
|
256
|
+
correct: false,
|
|
268
257
|
});
|
|
269
258
|
acc.allChoicesAreCorrect = false;
|
|
270
259
|
}
|
|
@@ -274,8 +263,8 @@ export const buildChoices = (possibleResponseChoices, builtCategoryChoices) => {
|
|
|
274
263
|
{
|
|
275
264
|
builtChoices: [],
|
|
276
265
|
copyOfPossibleResponse: [...possibleResponseChoices],
|
|
277
|
-
allChoicesAreCorrect: true
|
|
278
|
-
}
|
|
266
|
+
allChoicesAreCorrect: true,
|
|
267
|
+
},
|
|
279
268
|
);
|
|
280
269
|
};
|
|
281
270
|
|
|
@@ -294,22 +283,19 @@ export const getBuiltCategories = (possibleResponse, builtCategories) =>
|
|
|
294
283
|
const possibleResponseChoices = possibleResponse[builtCategory.id] || []; // the correct choices for this category
|
|
295
284
|
const builtCategoryChoices = builtCategory.choices || []; // the choices in the answer
|
|
296
285
|
|
|
297
|
-
const { builtChoices, allChoicesAreCorrect } = buildChoices(
|
|
298
|
-
possibleResponseChoices,
|
|
299
|
-
builtCategoryChoices
|
|
300
|
-
);
|
|
286
|
+
const { builtChoices, allChoicesAreCorrect } = buildChoices(possibleResponseChoices, builtCategoryChoices);
|
|
301
287
|
const allChoicesAreInAnswer = builtCategoryChoices.length === possibleResponseChoices.length;
|
|
302
288
|
|
|
303
289
|
acc.builtCategories.push({
|
|
304
290
|
...builtCategory,
|
|
305
291
|
correct: allChoicesAreCorrect && allChoicesAreInAnswer,
|
|
306
|
-
choices: builtChoices
|
|
292
|
+
choices: builtChoices,
|
|
307
293
|
});
|
|
308
294
|
acc.correct = acc.correct && allChoicesAreCorrect && allChoicesAreInAnswer;
|
|
309
295
|
|
|
310
296
|
return acc;
|
|
311
297
|
},
|
|
312
|
-
{ builtCategories: [], correct: true }
|
|
298
|
+
{ builtCategories: [], correct: true },
|
|
313
299
|
);
|
|
314
300
|
|
|
315
301
|
/**
|
|
@@ -319,7 +305,7 @@ export const getBuiltCategories = (possibleResponse, builtCategories) =>
|
|
|
319
305
|
* @returns {Object[]}, returns Response[]
|
|
320
306
|
* Response = { CategoryId: ChoiceId[] },
|
|
321
307
|
*/
|
|
322
|
-
export const getAllPossibleResponses = correctResponse => {
|
|
308
|
+
export const getAllPossibleResponses = (correctResponse) => {
|
|
323
309
|
if (!correctResponse) {
|
|
324
310
|
return [];
|
|
325
311
|
}
|
|
@@ -362,13 +348,13 @@ export const buildCategories = (categories, choices, answers) => {
|
|
|
362
348
|
answers = answers || [];
|
|
363
349
|
choices = choices || [];
|
|
364
350
|
|
|
365
|
-
return categories.map(category => {
|
|
366
|
-
const answer = answers.find(answer => answer.category === category.id);
|
|
351
|
+
return categories.map((category) => {
|
|
352
|
+
const answer = answers.find((answer) => answer.category === category.id);
|
|
367
353
|
const { choices: answerChoices = [] } = answer || {};
|
|
368
354
|
|
|
369
355
|
return {
|
|
370
356
|
...category,
|
|
371
|
-
choices: answerChoices.map(chId => choices.find(ch => ch.id === chId))
|
|
357
|
+
choices: answerChoices.map((chId) => choices.find((ch) => ch.id === chId)),
|
|
372
358
|
};
|
|
373
359
|
});
|
|
374
360
|
};
|
|
@@ -400,7 +386,7 @@ export const buildState = (categories, choices, answers, correctResponse) => {
|
|
|
400
386
|
// set correctness for each possible response
|
|
401
387
|
const { builtCategories: categoriesWithChoices, correct } = getBuiltCategories(
|
|
402
388
|
possibleResponse,
|
|
403
|
-
builtCategories
|
|
389
|
+
builtCategories,
|
|
404
390
|
);
|
|
405
391
|
|
|
406
392
|
// if bestResponse not found yet OR no correct response found yet and this one is the correct one
|
|
@@ -408,7 +394,7 @@ export const buildState = (categories, choices, answers, correctResponse) => {
|
|
|
408
394
|
return {
|
|
409
395
|
bestResponse: possibleResponse,
|
|
410
396
|
builtCategories: categoriesWithChoices,
|
|
411
|
-
entirelyCorrect: correct
|
|
397
|
+
entirelyCorrect: correct,
|
|
412
398
|
};
|
|
413
399
|
}
|
|
414
400
|
|
|
@@ -417,8 +403,8 @@ export const buildState = (categories, choices, answers, correctResponse) => {
|
|
|
417
403
|
{
|
|
418
404
|
bestResponse: null,
|
|
419
405
|
builtCategories: [],
|
|
420
|
-
entirelyCorrect: false
|
|
421
|
-
}
|
|
406
|
+
entirelyCorrect: false,
|
|
407
|
+
},
|
|
422
408
|
);
|
|
423
409
|
|
|
424
410
|
builtCategories = builtData.builtCategories;
|
|
@@ -426,14 +412,12 @@ export const buildState = (categories, choices, answers, correctResponse) => {
|
|
|
426
412
|
entirelyCorrect = builtData.entirelyCorrect;
|
|
427
413
|
}
|
|
428
414
|
|
|
429
|
-
const filteredChoices = choices.map(ch =>
|
|
430
|
-
stillSelectable(ch, builtCategories) ? ch : { empty: true }
|
|
431
|
-
);
|
|
415
|
+
const filteredChoices = choices.map((ch) => (stillSelectable(ch, builtCategories) ? ch : { empty: true }));
|
|
432
416
|
|
|
433
417
|
return {
|
|
434
418
|
choices: filteredChoices,
|
|
435
419
|
categories: builtCategories,
|
|
436
420
|
correct: entirelyCorrect,
|
|
437
|
-
bestResponse
|
|
421
|
+
bestResponse,
|
|
438
422
|
};
|
|
439
423
|
};
|
package/src/scoring.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import debug from 'debug';
|
|
2
2
|
const log = debug('@pie-lib:categorize:scoring');
|
|
3
|
-
const getWeightingRules = scoring => {
|
|
3
|
+
const getWeightingRules = (scoring) => {
|
|
4
4
|
if (!scoring || !scoring.weighting) {
|
|
5
5
|
return [];
|
|
6
6
|
} else {
|
|
@@ -18,7 +18,7 @@ const getPartialRulesForCategory = (partial, categoryId) => {
|
|
|
18
18
|
if (!partial || !partial.enabled) {
|
|
19
19
|
return;
|
|
20
20
|
} else {
|
|
21
|
-
const pr = partial.rules.find(pr => pr.category === categoryId);
|
|
21
|
+
const pr = partial.rules.find((pr) => pr.category === categoryId);
|
|
22
22
|
return pr ? pr.rules || [] : [];
|
|
23
23
|
}
|
|
24
24
|
};
|
|
@@ -32,26 +32,26 @@ const getPartialRulesForCategory = (partial, categoryId) => {
|
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
34
|
export const score = (categories, scoring) =>
|
|
35
|
-
new Promise(resolve => {
|
|
35
|
+
new Promise((resolve) => {
|
|
36
36
|
log('categories: ', categories, 'scoring: ', scoring);
|
|
37
37
|
const weightingRules = getWeightingRules(scoring);
|
|
38
38
|
|
|
39
|
-
const weights = categories.map(c => {
|
|
40
|
-
const r = weightingRules.find(r => r.category === c.id) || { points: 1 };
|
|
39
|
+
const weights = categories.map((c) => {
|
|
40
|
+
const r = weightingRules.find((r) => r.category === c.id) || { points: 1 };
|
|
41
41
|
return { ...r, category: c.id };
|
|
42
42
|
});
|
|
43
43
|
|
|
44
44
|
log('weights: ', weights);
|
|
45
45
|
|
|
46
46
|
const weightTotal = categories.reduce((total, c) => {
|
|
47
|
-
const r = weights.find(r => r.category === c.id);
|
|
47
|
+
const r = weights.find((r) => r.category === c.id);
|
|
48
48
|
return (total += r.points);
|
|
49
49
|
}, 0);
|
|
50
50
|
|
|
51
51
|
log('total: ', weightTotal);
|
|
52
52
|
|
|
53
|
-
const withScore = categories.map(c => {
|
|
54
|
-
const w = weights.find(r => r.category === c.id).points;
|
|
53
|
+
const withScore = categories.map((c) => {
|
|
54
|
+
const w = weights.find((r) => r.category === c.id).points;
|
|
55
55
|
|
|
56
56
|
log('category: ', c);
|
|
57
57
|
if (c.correct === true) {
|
|
@@ -62,9 +62,9 @@ export const score = (categories, scoring) =>
|
|
|
62
62
|
if (!rules) {
|
|
63
63
|
return { category: c.id, score: 0, points: w };
|
|
64
64
|
} else {
|
|
65
|
-
const correctCount = (c.choices || []).filter(h => h.correct).length;
|
|
65
|
+
const correctCount = (c.choices || []).filter((h) => h.correct).length;
|
|
66
66
|
log('correctCount: ', correctCount);
|
|
67
|
-
let rule = rules.find(u => u.count === correctCount);
|
|
67
|
+
let rule = rules.find((u) => u.count === correctCount);
|
|
68
68
|
log('rule: ', rule);
|
|
69
69
|
rule = rule || { percent: 0, count: correctCount };
|
|
70
70
|
const score = w * (rule.percent / 100);
|
|
@@ -74,8 +74,8 @@ export const score = (categories, scoring) =>
|
|
|
74
74
|
points: w,
|
|
75
75
|
partial: {
|
|
76
76
|
correctChoices: correctCount,
|
|
77
|
-
rule: rule
|
|
78
|
-
}
|
|
77
|
+
rule: rule,
|
|
78
|
+
},
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -93,9 +93,9 @@ export const score = (categories, scoring) =>
|
|
|
93
93
|
details: {
|
|
94
94
|
weighted: {
|
|
95
95
|
total: weightTotal,
|
|
96
|
-
score: weightedScore
|
|
96
|
+
score: weightedScore,
|
|
97
97
|
},
|
|
98
|
-
categories: withScore
|
|
99
|
-
}
|
|
98
|
+
categories: withScore,
|
|
99
|
+
},
|
|
100
100
|
});
|
|
101
101
|
});
|