@pie-lib/controller-utils 0.2.44-next.0 → 0.2.45-next.1848

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.json CHANGED
@@ -1,137 +1 @@
1
- [
2
- {
3
- "type": "feat",
4
- "scope": null,
5
- "subject": "new package controller-utils",
6
- "merge": null,
7
- "header": "feat: new package controller-utils",
8
- "body": null,
9
- "footer": null,
10
- "notes": [],
11
- "hash": "0994a4bda1c0ed809e565ff3569bbbf8f0713bd0",
12
- "gitTags": "",
13
- "committerDate": "2019-04-02 17:02:30 +0100",
14
- "isTagged": true,
15
- "tag": "@pie-lib/controller-utils@0.1.0"
16
- },
17
- {
18
- "type": "feat",
19
- "scope": null,
20
- "subject": "implement a shuffle/persistence reusable method",
21
- "merge": null,
22
- "header": "feat: implement a shuffle/persistence reusable method",
23
- "body": null,
24
- "footer": null,
25
- "notes": [],
26
- "hash": "33cc7f3ea35019d9896b656134672950c145d28d",
27
- "gitTags": "",
28
- "committerDate": "2019-08-29 19:15:16 +0300",
29
- "isTagged": true,
30
- "tag": "@pie-lib/controller-utils@0.2.0"
31
- },
32
- {
33
- "type": "fix",
34
- "scope": null,
35
- "subject": "fix handling and saving of bad shuffled values [ch4723]",
36
- "merge": null,
37
- "header": "fix: fix handling and saving of bad shuffled values [ch4723]",
38
- "body": "* strip null/undefined from arrays, treat empty arrays as if no shuffle\nis set.\n* refuse to save stripped empty shuffled arrays",
39
- "footer": null,
40
- "notes": [],
41
- "hash": "186ff87e9e8db7952203e1629ade8e0c49b56f6b",
42
- "gitTags": "",
43
- "committerDate": "2019-10-10 19:29:34 +0100",
44
- "isTagged": true,
45
- "tag": "@pie-lib/controller-utils@0.2.1"
46
- },
47
- {
48
- "type": "fix",
49
- "scope": null,
50
- "subject": "rm async",
51
- "merge": null,
52
- "header": "fix: rm async",
53
- "body": null,
54
- "footer": null,
55
- "notes": [],
56
- "hash": "3e96db3e5897896f95ed21ec1fc86a029c49b8d6",
57
- "gitTags": " (origin/fix/rm-async, origin/develop, origin/HEAD, develop)",
58
- "committerDate": "2019-10-14 13:47:35 +0100",
59
- "isTagged": true,
60
- "tag": "@pie-lib/controller-utils@0.2.2"
61
- },
62
- {
63
- "type": "fix",
64
- "scope": null,
65
- "subject": "allow number 0 to be used as value in shuffledValues",
66
- "merge": null,
67
- "header": "fix: allow number 0 to be used as value in shuffledValues",
68
- "body": null,
69
- "footer": null,
70
- "notes": [],
71
- "hash": "874127ce12bcfa6403d7b883b469f3fd2f09a365",
72
- "gitTags": " (origin/develop, origin/HEAD, develop)",
73
- "committerDate": "2019-11-18 11:28:05 +0000",
74
- "isTagged": true,
75
- "tag": "@pie-lib/controller-utils@0.2.3"
76
- },
77
- {
78
- "type": "fix",
79
- "scope": null,
80
- "subject": "Updated using the given documentation.",
81
- "merge": null,
82
- "header": "fix: Updated using the given documentation.",
83
- "body": null,
84
- "footer": null,
85
- "notes": [],
86
- "hash": "14c7b98d1fd3bc20ea3aefc1d3a7db4d4e9bcb14",
87
- "gitTags": " (origin/fix/PIE-200-partial-scoring)",
88
- "committerDate": "2020-01-15 13:25:30 +0200",
89
- "isTagged": true,
90
- "tag": "@pie-lib/controller-utils@0.2.4"
91
- },
92
- {
93
- "type": "fix",
94
- "scope": null,
95
- "subject": "add module prop to package.json",
96
- "merge": null,
97
- "header": "fix: add module prop to package.json",
98
- "body": null,
99
- "footer": null,
100
- "notes": [],
101
- "hash": "8a1b445ad76ba8472a6d375d0c604baf951a3b25",
102
- "gitTags": " (develop)",
103
- "committerDate": "2020-03-29 23:12:09 +0100",
104
- "isTagged": true,
105
- "tag": "@pie-lib/controller-utils@0.2.6"
106
- },
107
- {
108
- "type": "fix",
109
- "scope": null,
110
- "subject": "add module prop to package.json",
111
- "merge": null,
112
- "header": "fix: add module prop to package.json",
113
- "body": null,
114
- "footer": null,
115
- "notes": [],
116
- "hash": "694b1065959105438aeed7fcd88d5537ce234802",
117
- "gitTags": "",
118
- "committerDate": "2020-03-30 13:00:38 +0100",
119
- "isTagged": true,
120
- "tag": "@pie-lib/controller-utils@0.2.7"
121
- },
122
- {
123
- "type": "fix",
124
- "scope": null,
125
- "subject": "rm ExportNamespaceSpecifier",
126
- "merge": null,
127
- "header": "fix: rm ExportNamespaceSpecifier",
128
- "body": null,
129
- "footer": null,
130
- "notes": [],
131
- "hash": "970e2edcf797b8eea06449834c9174ac69d718d1",
132
- "gitTags": "",
133
- "committerDate": "2020-03-31 12:35:26 +0100",
134
- "isTagged": true,
135
- "tag": "@pie-lib/controller-utils@0.2.16"
136
- }
137
- ]
1
+ []
package/CHANGELOG.md CHANGED
@@ -3,18 +3,39 @@
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.2.43](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.42...@pie-lib/controller-utils@0.2.43) (2023-04-19)
6
+ # [0.17.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.16.0...@pie-lib/controller-utils@0.17.0) (2025-09-18)
7
+
8
+ **Note:** Version bump only for package @pie-lib/controller-utils
9
+
10
+
11
+
12
+
13
+
14
+ # [0.16.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.15.0...@pie-lib/controller-utils@0.16.0) (2025-09-18)
15
+
16
+ **Note:** Version bump only for package @pie-lib/controller-utils
17
+
18
+
19
+
20
+
21
+
22
+ # [0.15.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.15.0) (2025-09-18)
7
23
 
8
24
 
9
25
  ### Bug Fixes
10
26
 
11
- * **eslint:** fix eslint problems-AC-2732 ([9eb9976](https://github.com/pie-framework/pie-lib/commit/9eb9976749753da86e1057a07bd2cfc65bf64ae4))
27
+ * fixed pie-lib/icons import [PD-5126] ([dcb506c](https://github.com/pie-framework/pie-lib/commit/dcb506c914a177f6d88bf73247a023bfe71dac1f))
12
28
 
13
29
 
30
+ ### Features
14
31
 
32
+ * split pie-toolbox into multiple packages [PD-5126] ([7d55a25](https://github.com/pie-framework/pie-lib/commit/7d55a2552d084cd3d0d5c00dc77411b2ced2f5e2))
15
33
 
16
34
 
17
- ## [0.2.42](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.40...@pie-lib/controller-utils@0.2.42) (2023-01-31)
35
+
36
+
37
+
38
+ # [0.14.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.13.0...@pie-lib/controller-utils@0.14.0) (2025-09-17)
18
39
 
19
40
  **Note:** Version bump only for package @pie-lib/controller-utils
20
41
 
@@ -22,7 +43,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
22
43
 
23
44
 
24
45
 
25
- ## [0.2.40](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.39...@pie-lib/controller-utils@0.2.40) (2023-01-31)
46
+ # [0.13.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.12.0...@pie-lib/controller-utils@0.13.0) (2025-09-17)
26
47
 
27
48
  **Note:** Version bump only for package @pie-lib/controller-utils
28
49
 
@@ -30,7 +51,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
30
51
 
31
52
 
32
53
 
33
- ## [0.2.39](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.38...@pie-lib/controller-utils@0.2.39) (2023-01-31)
54
+ # [0.12.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.11.1...@pie-lib/controller-utils@0.12.0) (2025-09-17)
34
55
 
35
56
  **Note:** Version bump only for package @pie-lib/controller-utils
36
57
 
@@ -38,45 +59,209 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
38
59
 
39
60
 
40
61
 
41
- ## [0.2.38](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.37...@pie-lib/controller-utils@0.2.38) (2023-01-31)
62
+ ## [0.11.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.11.1) (2025-08-11)
63
+
64
+
65
+ ### Bug Fixes
66
+
67
+ * fixed pie-lib/icons import [PD-5126] ([dcb506c](https://github.com/pie-framework/pie-lib/commit/dcb506c914a177f6d88bf73247a023bfe71dac1f))
68
+
69
+
70
+ ### Features
71
+
72
+ * split pie-toolbox into multiple packages [PD-5126] ([7d55a25](https://github.com/pie-framework/pie-lib/commit/7d55a2552d084cd3d0d5c00dc77411b2ced2f5e2))
73
+
74
+
75
+
76
+
77
+
78
+ # [0.11.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.11.0) (2025-08-07)
79
+
80
+ ### Features
81
+
82
+ - split pie-toolbox into multiple packages [PD-5126](<[7d55a25](https://github.com/pie-framework/pie-lib/commit/7d55a2552d084cd3d0d5c00dc77411b2ced2f5e2)>)
83
+
84
+ # [0.10.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.10.0) (2025-07-31)
42
85
 
43
86
  **Note:** Version bump only for package @pie-lib/controller-utils
44
87
 
88
+ # [0.9.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.9.0) (2025-07-31)
45
89
 
90
+ **Note:** Version bump only for package @pie-lib/controller-utils
46
91
 
92
+ # [0.8.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.8.0) (2025-07-31)
47
93
 
94
+ **Note:** Version bump only for package @pie-lib/controller-utils
48
95
 
49
- ## [0.2.37](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.31...@pie-lib/controller-utils@0.2.37) (2023-01-31)
96
+ # [0.7.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.7.0) (2025-07-31)
50
97
 
51
98
  **Note:** Version bump only for package @pie-lib/controller-utils
52
99
 
100
+ # [0.6.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.6.0) (2025-07-31)
53
101
 
102
+ **Note:** Version bump only for package @pie-lib/controller-utils
54
103
 
104
+ # [0.5.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.5.0) (2025-07-31)
55
105
 
106
+ **Note:** Version bump only for package @pie-lib/controller-utils
56
107
 
57
- ## [0.2.31](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.29...@pie-lib/controller-utils@0.2.31) (2023-01-31)
108
+ # [0.7.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.7.0) (2025-07-31)
58
109
 
59
110
  **Note:** Version bump only for package @pie-lib/controller-utils
60
111
 
112
+ # [0.6.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.6.0) (2025-07-31)
61
113
 
114
+ **Note:** Version bump only for package @pie-lib/controller-utils
62
115
 
116
+ # [0.5.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.5.0) (2025-07-31)
63
117
 
118
+ **Note:** Version bump only for package @pie-lib/controller-utils
64
119
 
65
- ## [0.2.29](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.27...@pie-lib/controller-utils@0.2.29) (2023-01-31)
120
+ # [0.6.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.6.0) (2025-07-31)
66
121
 
67
122
  **Note:** Version bump only for package @pie-lib/controller-utils
68
123
 
124
+ # [0.5.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.5.0) (2025-07-31)
69
125
 
126
+ **Note:** Version bump only for package @pie-lib/controller-utils
70
127
 
128
+ # [0.4.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.4.0) (2025-07-31)
71
129
 
130
+ **Note:** Version bump only for package @pie-lib/controller-utils
72
131
 
73
- ## [0.2.27](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.26...@pie-lib/controller-utils@0.2.27) (2022-11-23)
132
+ # [0.4.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.4.0) (2025-07-31)
133
+
134
+ **Note:** Version bump only for package @pie-lib/controller-utils
135
+
136
+ # [0.5.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.5.0) (2025-07-31)
137
+
138
+ **Note:** Version bump only for package @pie-lib/controller-utils
139
+
140
+ # [0.4.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.4.0) (2025-07-31)
141
+
142
+ **Note:** Version bump only for package @pie-lib/controller-utils
143
+
144
+ # [0.3.0-beta.8](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.3.0-beta.8) (2025-07-25)
145
+
146
+ **Note:** Version bump only for package @pie-lib/controller-utils
147
+
148
+ # [0.3.0-beta.7](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.3.0-beta.7) (2025-07-25)
149
+
150
+ **Note:** Version bump only for package @pie-lib/controller-utils
151
+
152
+ # [0.3.0-beta.7](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.3.0-beta.7) (2025-07-25)
153
+
154
+ **Note:** Version bump only for package @pie-lib/controller-utils
155
+
156
+ # [0.3.0-beta.6](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.3.0-beta.6) (2025-07-25)
157
+
158
+ **Note:** Version bump only for package @pie-lib/controller-utils
159
+
160
+ # [0.3.0-beta.6](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.3.0-beta.6) (2025-07-25)
161
+
162
+ **Note:** Version bump only for package @pie-lib/controller-utils
163
+
164
+ # [0.3.0-beta.5](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.3.0-beta.5) (2025-07-25)
165
+
166
+ **Note:** Version bump only for package @pie-lib/controller-utils
167
+
168
+ # [0.3.0-beta.5](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.3.0-beta.5) (2025-07-25)
169
+
170
+ **Note:** Version bump only for package @pie-lib/controller-utils
171
+
172
+ # [0.3.0-beta.4](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.3.0-beta.4) (2025-07-25)
173
+
174
+ **Note:** Version bump only for package @pie-lib/controller-utils
175
+
176
+ # [0.3.0-beta.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.3.0-beta.3) (2025-07-25)
177
+
178
+ **Note:** Version bump only for package @pie-lib/controller-utils
179
+
180
+ # [0.3.0-beta.4](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.3.0-beta.4) (2025-07-23)
181
+
182
+ **Note:** Version bump only for package @pie-lib/controller-utils
183
+
184
+ # [0.3.0-beta.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.3.0-beta.3) (2025-07-23)
185
+
186
+ **Note:** Version bump only for package @pie-lib/controller-utils
187
+
188
+ # [0.3.0-beta.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.3.0-beta.3) (2025-07-20)
189
+
190
+ **Note:** Version bump only for package @pie-lib/controller-utils
191
+
192
+ # [0.3.0-beta.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.3.0-beta.2) (2025-07-20)
74
193
 
75
194
  **Note:** Version bump only for package @pie-lib/controller-utils
76
195
 
196
+ # [0.3.0-beta.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.3.0-beta.1) (2025-07-20)
77
197
 
198
+ **Note:** Version bump only for package @pie-lib/controller-utils
199
+
200
+ # [0.3.0-beta.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.3.0-beta.2) (2025-07-20)
201
+
202
+ **Note:** Version bump only for package @pie-lib/controller-utils
203
+
204
+ # [0.3.0-beta.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.3.0-beta.1) (2025-07-20)
205
+
206
+ **Note:** Version bump only for package @pie-lib/controller-utils
207
+
208
+ # [0.3.0-beta.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.3.0-beta.1) (2025-07-20)
209
+
210
+ **Note:** Version bump only for package @pie-lib/controller-utils
211
+
212
+ # [0.3.0-beta.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.3.0-beta.0) (2025-07-20)
213
+
214
+ **Note:** Version bump only for package @pie-lib/controller-utils
215
+
216
+ # [0.4.0-beta.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.4.0-beta.0) (2025-07-15)
217
+
218
+ **Note:** Version bump only for package @pie-lib/controller-utils
219
+
220
+ # [0.3.0-beta.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.44...@pie-lib/controller-utils@0.3.0-beta.0) (2025-07-15)
221
+
222
+ **Note:** Version bump only for package @pie-lib/controller-utils
78
223
 
224
+ ## [0.2.44](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.43...@pie-lib/controller-utils@0.2.44) (2023-06-24)
79
225
 
226
+ **Note:** Version bump only for package @pie-lib/controller-utils
227
+
228
+ ## [0.2.43](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.42...@pie-lib/controller-utils@0.2.43) (2023-04-19)
229
+
230
+ ### Bug Fixes
231
+
232
+ - **eslint:** fix eslint problems-PD-2732 ([9eb9976](https://github.com/pie-framework/pie-lib/commit/9eb9976749753da86e1057a07bd2cfc65bf64ae4))
233
+
234
+ ## [0.2.42](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.40...@pie-lib/controller-utils@0.2.42) (2023-01-31)
235
+
236
+ **Note:** Version bump only for package @pie-lib/controller-utils
237
+
238
+ ## [0.2.40](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.39...@pie-lib/controller-utils@0.2.40) (2023-01-31)
239
+
240
+ **Note:** Version bump only for package @pie-lib/controller-utils
241
+
242
+ ## [0.2.39](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.38...@pie-lib/controller-utils@0.2.39) (2023-01-31)
243
+
244
+ **Note:** Version bump only for package @pie-lib/controller-utils
245
+
246
+ ## [0.2.38](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.37...@pie-lib/controller-utils@0.2.38) (2023-01-31)
247
+
248
+ **Note:** Version bump only for package @pie-lib/controller-utils
249
+
250
+ ## [0.2.37](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.31...@pie-lib/controller-utils@0.2.37) (2023-01-31)
251
+
252
+ **Note:** Version bump only for package @pie-lib/controller-utils
253
+
254
+ ## [0.2.31](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.29...@pie-lib/controller-utils@0.2.31) (2023-01-31)
255
+
256
+ **Note:** Version bump only for package @pie-lib/controller-utils
257
+
258
+ ## [0.2.29](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.27...@pie-lib/controller-utils@0.2.29) (2023-01-31)
259
+
260
+ **Note:** Version bump only for package @pie-lib/controller-utils
261
+
262
+ ## [0.2.27](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.26...@pie-lib/controller-utils@0.2.27) (2022-11-23)
263
+
264
+ **Note:** Version bump only for package @pie-lib/controller-utils
80
265
 
81
266
  ## [0.2.26](https://github.com/pie-framework/pie-lib/compare/@pie-lib/controller-utils@0.2.24...@pie-lib/controller-utils@0.2.26) (2021-06-25)
82
267
 
@@ -0,0 +1 @@
1
+ []
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;AACA","sourcesContent":["import * as partialScoring from './partial-scoring';\nexport { lockChoices, getShuffledChoices } from './persistence';\nexport { partialScoring };\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;AAEA","sourcesContent":["import * as partialScoring from './partial-scoring';\n\nexport { lockChoices, getShuffledChoices } from './persistence';\nexport { partialScoring };\n"],"file":"index.js"}
@@ -1,14 +1,10 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports.enabled = void 0;
9
7
 
10
- var _lodash = _interopRequireDefault(require("lodash"));
11
-
12
8
  var enabled = function enabled(config, env, defaultValue) {
13
9
  // if model.partialScoring = false
14
10
  // - if env.partialScoring = false || env.partialScoring = true => use dichotomous scoring
@@ -26,7 +22,7 @@ var enabled = function enabled(config, env, defaultValue) {
26
22
  return false;
27
23
  }
28
24
 
29
- return _lodash["default"].isBoolean(defaultValue) ? defaultValue : true;
25
+ return typeof defaultValue === 'boolean' ? defaultValue : true;
30
26
  };
31
27
 
32
28
  exports.enabled = enabled;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/partial-scoring.js"],"names":["enabled","config","env","defaultValue","partialScoring","_","isBoolean"],"mappings":";;;;;;;;;AAAA;;AAEO,IAAMA,OAAO,GAAG,SAAVA,OAAU,CAACC,MAAD,EAASC,GAAT,EAAcC,YAAd,EAA+B;AACpD;AACA;AACA;AACA;AACA;AACAF,EAAAA,MAAM,GAAGA,MAAM,IAAI,EAAnB;AACAC,EAAAA,GAAG,GAAGA,GAAG,IAAI,EAAb;;AAEA,MAAID,MAAM,CAACG,cAAP,KAA0B,KAA9B,EAAqC;AACnC,WAAO,KAAP;AACD;;AAED,MAAIF,GAAG,CAACE,cAAJ,KAAuB,KAA3B,EAAkC;AAChC,WAAO,KAAP;AACD;;AAED,SAAOC,mBAAEC,SAAF,CAAYH,YAAZ,IAA4BA,YAA5B,GAA2C,IAAlD;AACD,CAlBM","sourcesContent":["import _ from 'lodash';\n\nexport const enabled = (config, env, defaultValue) => {\n // if model.partialScoring = false\n // - if env.partialScoring = false || env.partialScoring = true => use dichotomous scoring\n // else if model.partialScoring = true || undefined\n // - if env.partialScoring = false, use dichotomous scoring\n // - else if env.partialScoring = true, use partial scoring\n config = config || {};\n env = env || {};\n\n if (config.partialScoring === false) {\n return false;\n }\n\n if (env.partialScoring === false) {\n return false;\n }\n\n return _.isBoolean(defaultValue) ? defaultValue : true;\n};\n"],"file":"partial-scoring.js"}
1
+ {"version":3,"sources":["../src/partial-scoring.js"],"names":["enabled","config","env","defaultValue","partialScoring"],"mappings":";;;;;;;AAAO,IAAMA,OAAO,GAAG,SAAVA,OAAU,CAACC,MAAD,EAASC,GAAT,EAAcC,YAAd,EAA+B;AACpD;AACA;AACA;AACA;AACA;AACAF,EAAAA,MAAM,GAAGA,MAAM,IAAI,EAAnB;AACAC,EAAAA,GAAG,GAAGA,GAAG,IAAI,EAAb;;AAEA,MAAID,MAAM,CAACG,cAAP,KAA0B,KAA9B,EAAqC;AACnC,WAAO,KAAP;AACD;;AAED,MAAIF,GAAG,CAACE,cAAJ,KAAuB,KAA3B,EAAkC;AAChC,WAAO,KAAP;AACD;;AAED,SAAO,OAAOD,YAAP,KAAwB,SAAxB,GAAoCA,YAApC,GAAmD,IAA1D;AACD,CAlBM","sourcesContent":["export const enabled = (config, env, defaultValue) => {\n // if model.partialScoring = false\n // - if env.partialScoring = false || env.partialScoring = true => use dichotomous scoring\n // else if model.partialScoring = true || undefined\n // - if env.partialScoring = false, use dichotomous scoring\n // - else if env.partialScoring = true, use partial scoring\n config = config || {};\n env = env || {};\n\n if (config.partialScoring === false) {\n return false;\n }\n\n if (env.partialScoring === false) {\n return false;\n }\n\n return typeof defaultValue === 'boolean' ? defaultValue : true;\n};\n"],"file":"partial-scoring.js"}
@@ -15,10 +15,6 @@ var _shuffle = _interopRequireDefault(require("lodash/shuffle"));
15
15
 
16
16
  var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
17
17
 
18
- var _isNull = _interopRequireDefault(require("lodash/isNull"));
19
-
20
- var _isUndefined = _interopRequireDefault(require("lodash/isUndefined"));
21
-
22
18
  // eslint-disable-next-line no-console
23
19
  var lg = function lg(n) {
24
20
  return console[n].bind(console, 'controller-utils:');
@@ -32,7 +28,7 @@ var error = lg('error');
32
28
  var compact = function compact(arr) {
33
29
  if (Array.isArray(arr)) {
34
30
  return arr.filter(function (v) {
35
- return !(0, _isNull["default"])(v) && !(0, _isUndefined["default"])(v);
31
+ return v !== null && v !== undefined;
36
32
  });
37
33
  }
38
34
 
@@ -43,16 +39,20 @@ exports.compact = compact;
43
39
 
44
40
  var getShuffledChoices = function getShuffledChoices(choices, session, updateSession, choiceKey) {
45
41
  return new Promise(function (resolve) {
42
+ var _session$data;
43
+
46
44
  log('updateSession type: ', (0, _typeof2["default"])(updateSession));
47
45
  log('session: ', session);
48
- var currentShuffled = compact((session || {}).shuffledValues);
46
+ var currentShuffled = compact((session === null || session === void 0 ? void 0 : (_session$data = session.data) === null || _session$data === void 0 ? void 0 : _session$data.shuffledValues) || (session === null || session === void 0 ? void 0 : session.shuffledValues) || []);
49
47
 
50
48
  if (!session) {
51
49
  // eslint-disable-next-line quotes
52
50
  warn("unable to save shuffled choices because there's no session.");
53
51
  resolve(undefined);
54
52
  } else if (!(0, _isEmpty["default"])(currentShuffled)) {
55
- debug('use shuffledValues to sort the choices...', session.shuffledValues);
53
+ var _session$data2;
54
+
55
+ debug('use shuffledValues to sort the choices...', (_session$data2 = session.data) === null || _session$data2 === void 0 ? void 0 : _session$data2.shuffledValues);
56
56
  resolve(compact(currentShuffled.map(function (v) {
57
57
  return choices.find(function (c) {
58
58
  return c[choiceKey] === v;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/persistence.js"],"names":["lg","n","console","bind","debug","log","warn","error","compact","arr","Array","isArray","filter","v","getShuffledChoices","choices","session","updateSession","choiceKey","Promise","resolve","currentShuffled","shuffledValues","undefined","map","find","c","shuffledChoices","id","element","JSON","stringify","e","lockChoices","model","env","lockChoiceOrder","role"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAEA;AACA,IAAMA,EAAE,GAAG,SAALA,EAAK,CAACC,CAAD;AAAA,SAAOC,OAAO,CAACD,CAAD,CAAP,CAAWE,IAAX,CAAgBD,OAAhB,EAAyB,mBAAzB,CAAP;AAAA,CAAX;;AACA,IAAME,KAAK,GAAGJ,EAAE,CAAC,OAAD,CAAhB;AACA,IAAMK,GAAG,GAAGL,EAAE,CAAC,KAAD,CAAd;AACA,IAAMM,IAAI,GAAGN,EAAE,CAAC,MAAD,CAAf;AACA,IAAMO,KAAK,GAAGP,EAAE,CAAC,OAAD,CAAhB;;AAEO,IAAMQ,OAAO,GAAG,SAAVA,OAAU,CAACC,GAAD,EAAS;AAC9B,MAAIC,KAAK,CAACC,OAAN,CAAcF,GA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tB,CAAH;;AAEA,MAAI,qBAAIA,GAAJ,EAAS,CAAC,cAAD,EAAiB,iBAAjB,CAAT,EAA8C,KAA9C,CAAJ,EAA0D;AACxD,WAAO,IAAP;AACD;;AAED,MAAME,IAAI,GAAG,qBAAIF,GAAJ,EAAS,MAAT,EAAiB,SAAjB,CAAb;;AAEA,MAAIE,IAAI,KAAK,YAAb,EAA2B;AACzB;;AACA;AACJ;AACA;AACA;AACA;AAGI,WAAO,IAAP;AACD,GAvBiD,CAyBlD;;;AACA,SAAO,KAAP;AACD,CA3BM","sourcesContent":["import get from 'lodash/get';\nimport shuffle from 'lodash/shuffle';\nimport isEmpty from 'lodash/isEmpty';\nimport isNull from 'lodash/isNull';\nimport isUndefined from 'lodash/isUndefined';\n\n// eslint-disable-next-line no-console\nconst lg = (n) => console[n].bind(console, 'controller-utils:');\nconst debug = lg('debug');\nconst log = lg('log');\nconst warn = lg('warn');\nconst error = lg('error');\n\nexport const compact = (arr) => {\n if (Array.isArray(arr)) {\n return arr.filter((v) => !isNull(v) && !isUndefined(v));\n }\n return arr;\n};\n\nexport const getShuffledChoices = (choices, session, updateSession, choiceKey) =>\n new Promise((resolve) => {\n log('updateSession type: ', typeof updateSession);\n log('session: ', session);\n\n const currentShuffled = compact((session || {}).shuffledValues);\n\n if (!session) {\n // eslint-disable-next-line quotes\n warn(\"unable to save shuffled choices because there's no session.\");\n resolve(undefined);\n } else if (!isEmpty(currentShuffled)) {\n debug('use shuffledValues to sort the choices...', session.shuffledValues);\n resolve(compact(currentShuffled.map((v) => choices.find((c) => c[choiceKey] === v))));\n } else {\n const shuffledChoices = shuffle(choices);\n\n if (updateSession && typeof updateSession === 'function') {\n try {\n //Note: session.id refers to the id of the element within a session\n const shuffledValues = compact(shuffledChoices.map((c) => c[choiceKey]));\n log('try to save shuffledValues to session...', shuffledValues);\n log('call updateSession... ', session.id, session.element);\n if (isEmpty(shuffledValues)) {\n error(\n `shuffledValues is an empty array? - refusing to call updateSession: shuffledChoices: ${JSON.stringify(\n shuffledChoices,\n )}, key: ${choiceKey}`,\n );\n } else {\n updateSession(session.id, session.element, { shuffledValues }).catch((e) =>\n // eslint-disable-next-line no-console\n console.error('update session failed for: ', session.id, e),\n );\n }\n } catch (e) {\n warn('unable to save shuffled order for choices');\n error(e);\n }\n } else {\n warn('unable to save shuffled choices, shuffle will happen every time.');\n }\n //save this shuffle to the session for later retrieval\n resolve(shuffledChoices);\n }\n });\n\n/**\n * If we return:\n * - true - that means that the order of the choices will be ordinal (as is created in the configure item)\n * - false - that means the getShuffledChoices above will be called and that in turn means that we either\n * return the shuffled values on the session (if any exists) or we shuffle the choices\n * @param model - model to check if we should lock order\n * @param session - session to check if we should lock order\n * @param env - env to check if we should lock order\n * @returns {boolean}\n */\nexport const lockChoices = (model, session, env) => {\n if (model.lockChoiceOrder) {\n return true;\n }\n\n log('lockChoiceOrder: ', get(env, ['@pie-element', 'lockChoiceOrder'], false));\n\n if (get(env, ['@pie-element', 'lockChoiceOrder'], false)) {\n return true;\n }\n\n const role = get(env, 'role', 'student');\n\n if (role === 'instructor') {\n // TODO: .. in the future the instructor can toggle between ordinal and shuffled here, so keeping this code until then\n /*const alreadyShuffled = hasShuffledValues(session);\n\n if (alreadyShuffled) {\n return false;\n }\n\n return true;*/\n return true;\n }\n\n // here it's a student, so don't lock and it will shuffle if needs be\n return false;\n};\n"],"file":"persistence.js"}
1
+ {"version":3,"sources":["../src/persistence.js"],"names":["lg","n","console","bind","debug","log","warn","error","compact","arr","Array","isArray","filter","v","undefined","getShuffledChoices","choices","session","updateSession","choiceKey","Promise","resolve","currentShuffled","data","shuffledValues","map","find","c","shuffledChoices","id","element","JSON","stringify","e","lockChoices","model","env","lockChoiceOrder","role"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;AACA,IAAMA,EAAE,GAAG,SAALA,EAAK,CAACC,CAAD;AAAA,SAAOC,OAAO,CAACD,CAAD,CAAP,CAAWE,IAAX,CAAgBD,OAAhB,EAAyB,mB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BD,MAsBO;AACL3B,QAAAA,IAAI,CAAC,kEAAD,CAAJ;AACD,OA3BI,CA4BL;;;AACAe,MAAAA,OAAO,CAACO,eAAD,CAAP;AACD;AACF,GA5CD,CADgC;AAAA,CAA3B;AA+CP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACO,IAAMM,WAAW,GAAG,SAAdA,WAAc,CAACC,KAAD,EAAQlB,OAAR,EAAiBmB,GAAjB,EAAyB;AAClD,MAAID,KAAK,CAACE,eAAV,EAA2B;AACzB,WAAO,IAAP;AACD;;AAEDhC,EAAAA,GAAG,CAAC,mBAAD,EAAsB,qBAAI+B,GAAJ,EAAS,CAAC,cAAD,EAAiB,iBAAjB,CAAT,EAA8C,KAA9C,CAAtB,CAAH;;AAEA,MAAI,qBAAIA,GAAJ,EAAS,CAAC,cAAD,EAAiB,iBAAjB,CAAT,EAA8C,KAA9C,CAAJ,EAA0D;AACxD,WAAO,IAAP;AACD;;AAED,MAAME,IAAI,GAAG,qBAAIF,GAAJ,EAAS,MAAT,EAAiB,SAAjB,CAAb;;AAEA,MAAIE,IAAI,KAAK,YAAb,EAA2B;AACzB;;AACA;AACJ;AACA;AACA;AACA;AAGI,WAAO,IAAP;AACD,GAvBiD,CAyBlD;;;AACA,SAAO,KAAP;AACD,CA3BM","sourcesContent":["import get from 'lodash/get';\nimport shuffle from 'lodash/shuffle';\nimport isEmpty from 'lodash/isEmpty';\n\n// eslint-disable-next-line no-console\nconst lg = (n) => console[n].bind(console, 'controller-utils:');\nconst debug = lg('debug');\nconst log = lg('log');\nconst warn = lg('warn');\nconst error = lg('error');\n\nexport const compact = (arr) => {\n if (Array.isArray(arr)) {\n return arr.filter((v) => v !== null && v !== undefined);\n }\n return arr;\n};\n\nexport const getShuffledChoices = (choices, session, updateSession, choiceKey) =>\n new Promise((resolve) => {\n log('updateSession type: ', typeof updateSession);\n log('session: ', session);\n\n const currentShuffled = compact(session?.data?.shuffledValues || session?.shuffledValues || []);\n\n if (!session) {\n // eslint-disable-next-line quotes\n warn(\"unable to save shuffled choices because there's no session.\");\n resolve(undefined);\n } else if (!isEmpty(currentShuffled)) {\n debug('use shuffledValues to sort the choices...', session.data?.shuffledValues);\n resolve(compact(currentShuffled.map((v) => choices.find((c) => c[choiceKey] === v))));\n } else {\n const shuffledChoices = shuffle(choices);\n\n if (updateSession && typeof updateSession === 'function') {\n try {\n //Note: session.id refers to the id of the element within a session\n const shuffledValues = compact(shuffledChoices.map((c) => c[choiceKey]));\n log('try to save shuffledValues to session...', shuffledValues);\n log('call updateSession... ', session.id, session.element);\n if (isEmpty(shuffledValues)) {\n error(\n `shuffledValues is an empty array? - refusing to call updateSession: shuffledChoices: ${JSON.stringify(\n shuffledChoices,\n )}, key: ${choiceKey}`,\n );\n } else {\n updateSession(session.id, session.element, { shuffledValues }).catch((e) =>\n // eslint-disable-next-line no-console\n console.error('update session failed for: ', session.id, e),\n );\n }\n } catch (e) {\n warn('unable to save shuffled order for choices');\n error(e);\n }\n } else {\n warn('unable to save shuffled choices, shuffle will happen every time.');\n }\n //save this shuffle to the session for later retrieval\n resolve(shuffledChoices);\n }\n });\n\n/**\n * If we return:\n * - true - that means that the order of the choices will be ordinal (as is created in the configure item)\n * - false - that means the getShuffledChoices above will be called and that in turn means that we either\n * return the shuffled values on the session (if any exists) or we shuffle the choices\n * @param model - model to check if we should lock order\n * @param session - session to check if we should lock order\n * @param env - env to check if we should lock order\n * @returns {boolean}\n */\nexport const lockChoices = (model, session, env) => {\n if (model.lockChoiceOrder) {\n return true;\n }\n\n log('lockChoiceOrder: ', get(env, ['@pie-element', 'lockChoiceOrder'], false));\n\n if (get(env, ['@pie-element', 'lockChoiceOrder'], false)) {\n return true;\n }\n\n const role = get(env, 'role', 'student');\n\n if (role === 'instructor') {\n // TODO: .. in the future the instructor can toggle between ordinal and shuffled here, so keeping this code until then\n /*const alreadyShuffled = hasShuffledValues(session);\n\n if (alreadyShuffled) {\n return false;\n }\n\n return true;*/\n return true;\n }\n\n // here it's a student, so don't lock and it will shuffle if needs be\n return false;\n};\n"],"file":"persistence.js"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-lib/controller-utils",
3
- "version": "0.2.44-next.0+e0c54808",
3
+ "version": "0.2.45-next.1848+4ac095ca",
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": "e0c54808548f6765169719a19b13e416b7ecca46"
17
+ "gitHead": "4ac095ca931e5fe8f131f28f41dd61093bd55d98"
18
18
  }
@@ -0,0 +1,25 @@
1
+ import { enabled } from '../partial-scoring';
2
+
3
+ describe('enabled', () => {
4
+ const assertEnabled = (config, env, expected) => {
5
+ it(`returns ${expected} for: config: ${config.partialScoring}, env:${env.partialScoring}`, () => {
6
+ const result = enabled(config, env);
7
+ expect(result).toEqual(expected);
8
+ });
9
+ };
10
+
11
+ const config = (v) => ({ partialScoring: v });
12
+ const env = (v) => ({ partialScoring: v });
13
+
14
+ assertEnabled(config(undefined), env(undefined), true);
15
+ assertEnabled(config(undefined), env(true), true);
16
+ assertEnabled(config(undefined), env(false), false);
17
+
18
+ assertEnabled(config(false), env(undefined), false);
19
+ assertEnabled(config(false), env(true), false);
20
+ assertEnabled(config(false), env(false), false);
21
+
22
+ assertEnabled(config(true), env(undefined), true);
23
+ assertEnabled(config(true), env(true), true);
24
+ assertEnabled(config(true), env(false), false);
25
+ });
@@ -0,0 +1,151 @@
1
+ import { getShuffledChoices, lockChoices } from '../persistence';
2
+
3
+ describe('getShuffledChoices', () => {
4
+ let choices, session, updateSession, key;
5
+
6
+ beforeEach(() => {
7
+ updateSession = jest.fn().mockResolvedValue([]);
8
+ session = {
9
+ id: '1',
10
+ element: 'element',
11
+ };
12
+ choices = [
13
+ {
14
+ value: 1,
15
+ },
16
+ {
17
+ value: 2,
18
+ },
19
+ ];
20
+ key = 'value';
21
+ });
22
+
23
+ describe('0 key', () => {
24
+ it('calls update session w/ 0 as a key', async () => {
25
+ const result = await getShuffledChoices([{ value: 0 }, { value: 1 }], session, updateSession, 'value');
26
+ expect(updateSession).toHaveBeenCalledWith(session.id, session.element, {
27
+ shuffledValues: expect.arrayContaining([0, 1]),
28
+ });
29
+ });
30
+ });
31
+
32
+ describe('handles null values in session', () => {
33
+ beforeEach(async () => {
34
+ const result = await getShuffledChoices(choices, { ...session, shuffledValues: [null] }, updateSession, 'value');
35
+ });
36
+
37
+ it('calls updateSession w/ new shuffle cos [null] is treated as empty', () => {
38
+ expect(updateSession).toHaveBeenCalledWith(session.id, session.element, {
39
+ shuffledValues: expect.arrayContaining([1, 2]),
40
+ });
41
+ });
42
+ });
43
+ describe('bad shuffle generation does not call updateSession', () => {
44
+ beforeEach(async () => {
45
+ const result = await getShuffledChoices(choices, {}, updateSession, 'foo');
46
+ });
47
+ it('does not call update session', () => {
48
+ expect(updateSession).not.toHaveBeenCalled();
49
+ });
50
+ });
51
+
52
+ describe('session does not exist', () => {
53
+ it('returns undefined for empty session', async () => {
54
+ const result = await getShuffledChoices(choices, undefined, updateSession, key);
55
+ expect(result).toEqual(undefined);
56
+ });
57
+ });
58
+
59
+ describe('session exists', () => {
60
+ it('returns compact choices if session has shuffledValues', async () => {
61
+ session = { shuffledValues: [2, 1] };
62
+ const result = await getShuffledChoices(choices, session, updateSession, key);
63
+ expect(result).toEqual(expect.arrayContaining(choices));
64
+ });
65
+
66
+ it('returns shuffled choices if updateSession is a function', async () => {
67
+ session = {};
68
+ updateSession = jest.fn().mockResolvedValue();
69
+ const result = await getShuffledChoices(choices, session, updateSession, key);
70
+ expect(result).toEqual(expect.arrayContaining(choices));
71
+ });
72
+
73
+ it('calls updateSession as expected if updateSession is a function', async () => {
74
+ session = { id: '1', element: 'pie-element' };
75
+ await getShuffledChoices(choices, session, updateSession, key);
76
+ expect(updateSession).toHaveBeenCalledWith('1', 'pie-element', {
77
+ shuffledValues: expect.arrayContaining([1, 2]),
78
+ });
79
+ });
80
+ });
81
+ });
82
+
83
+ describe('lockChoices', () => {
84
+ const env = (lockChoiceOrder, role = 'student') => ({
85
+ '@pie-element': { lockChoiceOrder },
86
+ role,
87
+ });
88
+ const session = (shuffledValues) => ({ shuffledValues });
89
+ it.each`
90
+ modelLock | session | env | expected
91
+ ${true} | ${session()} | ${env(true)} | ${true}
92
+ ${true} | ${session()} | ${env(false)} | ${true}
93
+ ${false} | ${session()} | ${env(true)} | ${true}
94
+ ${false} | ${session()} | ${env(false)} | ${false}
95
+ ${false} | ${session()} | ${undefined} | ${false}
96
+ ${false} | ${undefined} | ${undefined} | ${false}
97
+ ${undefined} | ${session()} | ${env(false)} | ${false}
98
+ ${undefined} | ${session()} | ${env(undefined)} | ${false}
99
+ ${false} | ${session()} | ${env(false, 'instructor')} | ${true}
100
+ ${false} | ${session([0, 1])} | ${env(false, 'instructor')} | ${true}
101
+ ${false} | ${undefined} | ${env(false, 'instructor')} | ${true}
102
+ `('1. model.lockChoiceOrder: $modelLock, $session, $env => $expected', ({ modelLock, session, env, expected }) => {
103
+ const model = { lockChoiceOrder: modelLock };
104
+ const result = lockChoices(model, session, env);
105
+ expect(result).toEqual(expected);
106
+ });
107
+ });
108
+
109
+ describe('lockChoices mod', () => {
110
+ const env = (lockChoiceOrder, role = 'student') => ({
111
+ '@pie-element': { lockChoiceOrder },
112
+ role,
113
+ });
114
+ const session = (answers = ['foo', 'bar']) => ({ answers });
115
+ it.each`
116
+ modelLock | session | env | expected
117
+ ${true} | ${session()} | ${env(true)} | ${true}
118
+ ${true} | ${session()} | ${env(false)} | ${true}
119
+ ${false} | ${session()} | ${env(true)} | ${true}
120
+ ${false} | ${session()} | ${env(false)} | ${false}
121
+ ${undefined} | ${session()} | ${env(true)} | ${true}
122
+ ${undefined} | ${session()} | ${env(undefined)} | ${false}
123
+ ${undefined} | ${session()} | ${env(undefined, 'instructor')} | ${true}
124
+ `('2. model.lockChoiceOrder: $modelLock, $session, $env => $expected', ({ modelLock, session, env, expected }) => {
125
+ const model = { lockChoiceOrder: modelLock };
126
+ const result = lockChoices(model, session, env);
127
+ expect(result).toEqual(expected);
128
+ });
129
+ });
130
+
131
+ describe('lockChoices', () => {
132
+ const env = (lockChoiceOrder, role = 'student') => ({
133
+ '@pie-element': { lockChoiceOrder },
134
+ role,
135
+ });
136
+ const session = (shuffledValues) => ({ shuffledValues, answers: ['foo', 'bar'] });
137
+ it.each`
138
+ modelLock | session | env | expected
139
+ ${true} | ${session()} | ${env(true)} | ${true}
140
+ ${true} | ${session()} | ${env(false)} | ${true}
141
+ ${false} | ${session()} | ${env(true)} | ${true}
142
+ ${false} | ${session()} | ${env(false)} | ${false}
143
+ ${undefined} | ${session()} | ${env(true)} | ${true}
144
+ ${undefined} | ${session()} | ${env(undefined)} | ${false}
145
+ ${undefined} | ${session()} | ${env(undefined, 'instructor')} | ${true}
146
+ `('3. model.lockChoiceOrder: $modelLock, $env => $expected', ({ modelLock, session, env, expected }) => {
147
+ const model = { lockChoiceOrder: modelLock };
148
+ const result = lockChoices(model, session, env);
149
+ expect(result).toEqual(expected);
150
+ });
151
+ });
package/src/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  import * as partialScoring from './partial-scoring';
2
+
2
3
  export { lockChoices, getShuffledChoices } from './persistence';
3
4
  export { partialScoring };
@@ -1,5 +1,3 @@
1
- import _ from 'lodash';
2
-
3
1
  export const enabled = (config, env, defaultValue) => {
4
2
  // if model.partialScoring = false
5
3
  // - if env.partialScoring = false || env.partialScoring = true => use dichotomous scoring
@@ -17,5 +15,5 @@ export const enabled = (config, env, defaultValue) => {
17
15
  return false;
18
16
  }
19
17
 
20
- return _.isBoolean(defaultValue) ? defaultValue : true;
18
+ return typeof defaultValue === 'boolean' ? defaultValue : true;
21
19
  };
@@ -1,8 +1,6 @@
1
1
  import get from 'lodash/get';
2
2
  import shuffle from 'lodash/shuffle';
3
3
  import isEmpty from 'lodash/isEmpty';
4
- import isNull from 'lodash/isNull';
5
- import isUndefined from 'lodash/isUndefined';
6
4
 
7
5
  // eslint-disable-next-line no-console
8
6
  const lg = (n) => console[n].bind(console, 'controller-utils:');
@@ -13,7 +11,7 @@ const error = lg('error');
13
11
 
14
12
  export const compact = (arr) => {
15
13
  if (Array.isArray(arr)) {
16
- return arr.filter((v) => !isNull(v) && !isUndefined(v));
14
+ return arr.filter((v) => v !== null && v !== undefined);
17
15
  }
18
16
  return arr;
19
17
  };
@@ -23,14 +21,14 @@ export const getShuffledChoices = (choices, session, updateSession, choiceKey) =
23
21
  log('updateSession type: ', typeof updateSession);
24
22
  log('session: ', session);
25
23
 
26
- const currentShuffled = compact((session || {}).shuffledValues);
24
+ const currentShuffled = compact(session?.data?.shuffledValues || session?.shuffledValues || []);
27
25
 
28
26
  if (!session) {
29
27
  // eslint-disable-next-line quotes
30
28
  warn("unable to save shuffled choices because there's no session.");
31
29
  resolve(undefined);
32
30
  } else if (!isEmpty(currentShuffled)) {
33
- debug('use shuffledValues to sort the choices...', session.shuffledValues);
31
+ debug('use shuffledValues to sort the choices...', session.data?.shuffledValues);
34
32
  resolve(compact(currentShuffled.map((v) => choices.find((c) => c[choiceKey] === v))));
35
33
  } else {
36
34
  const shuffledChoices = shuffle(choices);
package/README.md DELETED
@@ -1,5 +0,0 @@
1
- # controller utils
2
-
3
- Some utilities for pie controllers.
4
-
5
- > This package must be able to run server and client side. _Don't add any client specific libraries to this package_.