jclic 2.1.21 → 2.1.22

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.
Files changed (173) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/jclic-node.js +1 -1
  3. package/dist/jclic-node.js.map +1 -1
  4. package/dist/jclic.min.js +2 -2
  5. package/dist/jclic.min.js.map +1 -1
  6. package/package.json +1 -1
  7. package/src/GlobalData.js +1 -1
  8. package/dist/1078.jclic-node.js +0 -282
  9. package/dist/1078.jclic-node.js.map +0 -1
  10. package/dist/1196.jclic-node.js +0 -808
  11. package/dist/1196.jclic-node.js.map +0 -1
  12. package/dist/1253.jclic-node.js +0 -1432
  13. package/dist/1253.jclic-node.js.map +0 -1
  14. package/dist/13.jclic-node.js +0 -103
  15. package/dist/13.jclic-node.js.map +0 -1
  16. package/dist/1567.jclic-node.js +0 -2313
  17. package/dist/1567.jclic-node.js.map +0 -1
  18. package/dist/1588.jclic-node.js +0 -602
  19. package/dist/1588.jclic-node.js.map +0 -1
  20. package/dist/1725.jclic-node.js +0 -836
  21. package/dist/1725.jclic-node.js.map +0 -1
  22. package/dist/1731.jclic-node.js +0 -438
  23. package/dist/1731.jclic-node.js.map +0 -1
  24. package/dist/1842.jclic-node.js +0 -651
  25. package/dist/1842.jclic-node.js.map +0 -1
  26. package/dist/2160.jclic-node.js +0 -1016
  27. package/dist/2160.jclic-node.js.map +0 -1
  28. package/dist/222.jclic-node.js +0 -129
  29. package/dist/222.jclic-node.js.map +0 -1
  30. package/dist/2316.jclic-node.js +0 -949
  31. package/dist/2316.jclic-node.js.map +0 -1
  32. package/dist/2355.jclic-node.js +0 -371
  33. package/dist/2355.jclic-node.js.map +0 -1
  34. package/dist/2366.jclic-node.js +0 -431
  35. package/dist/2366.jclic-node.js.map +0 -1
  36. package/dist/2379.jclic-node.js +0 -202
  37. package/dist/2379.jclic-node.js.map +0 -1
  38. package/dist/2437.jclic-node.js +0 -450
  39. package/dist/2437.jclic-node.js.map +0 -1
  40. package/dist/2531.jclic-node.js +0 -869
  41. package/dist/2531.jclic-node.js.map +0 -1
  42. package/dist/2608.jclic-node.js +0 -160
  43. package/dist/2608.jclic-node.js.map +0 -1
  44. package/dist/2715.jclic-node.js +0 -554
  45. package/dist/2715.jclic-node.js.map +0 -1
  46. package/dist/277.jclic-node.js +0 -22
  47. package/dist/277.jclic-node.js.map +0 -1
  48. package/dist/2921.jclic-node.js +0 -660
  49. package/dist/2921.jclic-node.js.map +0 -1
  50. package/dist/2952.jclic-node.js +0 -101
  51. package/dist/2952.jclic-node.js.map +0 -1
  52. package/dist/3018.jclic-node.js +0 -421
  53. package/dist/3018.jclic-node.js.map +0 -1
  54. package/dist/3019.jclic-node.js +0 -682
  55. package/dist/3019.jclic-node.js.map +0 -1
  56. package/dist/3231.jclic-node.js +0 -274
  57. package/dist/3231.jclic-node.js.map +0 -1
  58. package/dist/331.jclic-node.js +0 -115
  59. package/dist/331.jclic-node.js.map +0 -1
  60. package/dist/3391.jclic-node.js +0 -276
  61. package/dist/3391.jclic-node.js.map +0 -1
  62. package/dist/3502.jclic-node.js +0 -671
  63. package/dist/3502.jclic-node.js.map +0 -1
  64. package/dist/3653.jclic-node.js +0 -982
  65. package/dist/3653.jclic-node.js.map +0 -1
  66. package/dist/371.jclic.min.js +0 -2
  67. package/dist/371.jclic.min.js.map +0 -1
  68. package/dist/3856.jclic-node.js +0 -575
  69. package/dist/3856.jclic-node.js.map +0 -1
  70. package/dist/4112.jclic-node.js +0 -659
  71. package/dist/4112.jclic-node.js.map +0 -1
  72. package/dist/4123.jclic-node.js +0 -910
  73. package/dist/4123.jclic-node.js.map +0 -1
  74. package/dist/427.jclic-node.js +0 -894
  75. package/dist/427.jclic-node.js.map +0 -1
  76. package/dist/4483.jclic-node.js +0 -327
  77. package/dist/4483.jclic-node.js.map +0 -1
  78. package/dist/4548.jclic-node.js +0 -1078
  79. package/dist/4548.jclic-node.js.map +0 -1
  80. package/dist/466.jclic-node.js +0 -99
  81. package/dist/466.jclic-node.js.map +0 -1
  82. package/dist/485.jclic-node.js +0 -783
  83. package/dist/485.jclic-node.js.map +0 -1
  84. package/dist/4921.jclic-node.js +0 -500
  85. package/dist/4921.jclic-node.js.map +0 -1
  86. package/dist/5091.jclic-node.js +0 -239
  87. package/dist/5091.jclic-node.js.map +0 -1
  88. package/dist/520.jclic-node.js +0 -550
  89. package/dist/520.jclic-node.js.map +0 -1
  90. package/dist/5312.jclic-node.js +0 -1126
  91. package/dist/5312.jclic-node.js.map +0 -1
  92. package/dist/5338.jclic-node.js +0 -212
  93. package/dist/5338.jclic-node.js.map +0 -1
  94. package/dist/5344.jclic-node.js +0 -229
  95. package/dist/5344.jclic-node.js.map +0 -1
  96. package/dist/5550.jclic-node.js +0 -238
  97. package/dist/5550.jclic-node.js.map +0 -1
  98. package/dist/5626.jclic-node.js +0 -614
  99. package/dist/5626.jclic-node.js.map +0 -1
  100. package/dist/5977.jclic-node.js +0 -1081
  101. package/dist/5977.jclic-node.js.map +0 -1
  102. package/dist/6148.jclic-node.js +0 -345
  103. package/dist/6148.jclic-node.js.map +0 -1
  104. package/dist/6176.jclic-node.js +0 -481
  105. package/dist/6176.jclic-node.js.map +0 -1
  106. package/dist/6221.jclic-node.js +0 -1072
  107. package/dist/6221.jclic-node.js.map +0 -1
  108. package/dist/6238.jclic-node.js +0 -718
  109. package/dist/6238.jclic-node.js.map +0 -1
  110. package/dist/6454.jclic-node.js +0 -1413
  111. package/dist/6454.jclic-node.js.map +0 -1
  112. package/dist/6565.jclic-node.js +0 -294
  113. package/dist/6565.jclic-node.js.map +0 -1
  114. package/dist/6579.jclic-node.js +0 -719
  115. package/dist/6579.jclic-node.js.map +0 -1
  116. package/dist/6715.jclic-node.js +0 -148
  117. package/dist/6715.jclic-node.js.map +0 -1
  118. package/dist/6777.jclic-node.js +0 -171
  119. package/dist/6777.jclic-node.js.map +0 -1
  120. package/dist/6782.jclic-node.js +0 -1611
  121. package/dist/6782.jclic-node.js.map +0 -1
  122. package/dist/6847.jclic-node.js +0 -601
  123. package/dist/6847.jclic-node.js.map +0 -1
  124. package/dist/6856.jclic-node.js +0 -252
  125. package/dist/6856.jclic-node.js.map +0 -1
  126. package/dist/696.jclic-node.js +0 -1821
  127. package/dist/696.jclic-node.js.map +0 -1
  128. package/dist/698.jclic-node.js +0 -583
  129. package/dist/698.jclic-node.js.map +0 -1
  130. package/dist/704.jclic-node.js +0 -80
  131. package/dist/704.jclic-node.js.map +0 -1
  132. package/dist/7046.jclic-node.js +0 -735
  133. package/dist/7046.jclic-node.js.map +0 -1
  134. package/dist/7220.jclic-node.js +0 -156
  135. package/dist/7220.jclic-node.js.map +0 -1
  136. package/dist/7257.jclic-node.js +0 -931
  137. package/dist/7257.jclic-node.js.map +0 -1
  138. package/dist/743.jclic-node.js +0 -583
  139. package/dist/743.jclic-node.js.map +0 -1
  140. package/dist/757.jclic-node.js +0 -1072
  141. package/dist/757.jclic-node.js.map +0 -1
  142. package/dist/7781.jclic-node.js +0 -202
  143. package/dist/7781.jclic-node.js.map +0 -1
  144. package/dist/7912.jclic-node.js +0 -2103
  145. package/dist/7912.jclic-node.js.map +0 -1
  146. package/dist/827.jclic-node.js +0 -708
  147. package/dist/827.jclic-node.js.map +0 -1
  148. package/dist/8276.jclic-node.js +0 -409
  149. package/dist/8276.jclic-node.js.map +0 -1
  150. package/dist/8322.jclic-node.js +0 -498
  151. package/dist/8322.jclic-node.js.map +0 -1
  152. package/dist/8641.jclic-node.js +0 -360
  153. package/dist/8641.jclic-node.js.map +0 -1
  154. package/dist/8837.jclic-node.js +0 -651
  155. package/dist/8837.jclic-node.js.map +0 -1
  156. package/dist/8895.jclic-node.js +0 -151
  157. package/dist/8895.jclic-node.js.map +0 -1
  158. package/dist/9072.jclic-node.js +0 -1285
  159. package/dist/9072.jclic-node.js.map +0 -1
  160. package/dist/9078.jclic-node.js +0 -935
  161. package/dist/9078.jclic-node.js.map +0 -1
  162. package/dist/9103.jclic-node.js +0 -718
  163. package/dist/9103.jclic-node.js.map +0 -1
  164. package/dist/9359.jclic-node.js +0 -145
  165. package/dist/9359.jclic-node.js.map +0 -1
  166. package/dist/9409.jclic-node.js +0 -921
  167. package/dist/9409.jclic-node.js.map +0 -1
  168. package/dist/9513.jclic-node.js +0 -720
  169. package/dist/9513.jclic-node.js.map +0 -1
  170. package/dist/9704.jclic-node.js +0 -81
  171. package/dist/9704.jclic-node.js.map +0 -1
  172. package/dist/9950.jclic-node.js +0 -827
  173. package/dist/9950.jclic-node.js.map +0 -1
@@ -1,360 +0,0 @@
1
- "use strict";
2
- exports.id = 8641;
3
- exports.ids = [8641];
4
- exports.modules = {
5
-
6
- /***/ 8641:
7
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
-
9
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
11
- /* harmony export */ });
12
- /* unused harmony exports SessionReg, SessionRegInfo */
13
- /* harmony import */ var _SequenceReg_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6238);
14
- /**
15
- * File : report/SessionReg.js
16
- * Created : 17/05/2016
17
- * By : Francesc Busquets <francesc@gmail.com>
18
- *
19
- * JClic.js
20
- * An HTML5 player of JClic activities
21
- * https://projectestac.github.io/jclic.js
22
- *
23
- * @source https://github.com/projectestac/jclic.js
24
- *
25
- * @license EUPL-1.2
26
- * @licstart
27
- * (c) 2000-2020 Catalan Educational Telematic Network (XTEC)
28
- *
29
- * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
30
- * the European Commission- subsequent versions of the EUPL (the "Licence");
31
- * You may not use this work except in compliance with the Licence.
32
- *
33
- * You may obtain a copy of the Licence at:
34
- * https://joinup.ec.europa.eu/software/page/eupl
35
- *
36
- * Unless required by applicable law or agreed to in writing, software
37
- * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
38
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
39
- * Licence for the specific language governing permissions and limitations
40
- * under the Licence.
41
- * @licend
42
- * @module
43
- */
44
-
45
-
46
-
47
- /**
48
- * This class encapsulates data of a user's working session, usually associated to a single {@link module:project/JClicProject.JClicProject JClicProject}
49
- * It's main component is `sequences`, an array of {@link module:report/SequenceReg.SequenceReg SequenceReg} objects.
50
- */
51
- class SessionReg {
52
- /**
53
- * SessionReg constructor
54
- * @param {module:project/JClicProject.JClicProject} project - The JClicProject referenced by this session.
55
- * @param {string} [code] - Optional code to be used by this SessionReg
56
- */
57
- constructor(project, code) {
58
- this.projectName = project.name;
59
- this.code = code || project.code;
60
- this.sequences = [];
61
- this.actNames = [];
62
- this.started = new Date();
63
- this.info = new SessionRegInfo(this);
64
- this.reportableActs = project.reportableActs;
65
- }
66
-
67
- /**
68
- * Builds a complex object with the results of all activities done during this working session
69
- * @param {boolean} recalcInfo - When `true`, global variables (number of sequences, score, total time...)
70
- * will be recalculated from the data stored in the {@link module:report/SequenceReg.SequenceReg SequenceReg} objects.
71
- * @param {boolean} includeEmpty - When `true`, sequences without reported activities will be also included in the results
72
- * @returns {object} - An object containing the full session data
73
- */
74
- getData(recalcInfo, includeEmpty) {
75
- if (recalcInfo)
76
- this.info.recalc();
77
-
78
- const result = {
79
- projectName: this.projectName,
80
- played: this.info.nActivities,
81
- ratioPlayed: Math.round(this.info.ratioPlayed * 100),
82
- solved: this.info.nActSolved,
83
- ratioSolved: Math.round(this.info.ratioSolved * 100),
84
- actions: this.info.nActions,
85
- score: this.info.tScore,
86
- time: Math.round(this.info.tTime / 10) / 100,
87
- sequences: []
88
- };
89
-
90
- this.sequences.forEach(s => {
91
- const seq = s.getData();
92
- if (includeEmpty || seq.activities.length > 0)
93
- result.sequences.push(seq);
94
- });
95
- return result;
96
- }
97
-
98
- /**
99
- * Returns the `info` element associated to this SessionReg.
100
- * @returns {module:report/SessionReg.SessionRegInfo}
101
- */
102
- getInfo() {
103
- return this.info.recalc();
104
- }
105
-
106
- /**
107
- * Closes this session
108
- */
109
- end() {
110
- this.endSequence();
111
- }
112
-
113
- /**
114
- * This method should be called when the current working session finishes.
115
- */
116
- endSequence() {
117
- if (this.currentSequence && this.currentSequence.totalTime === 0)
118
- this.currentSequence.endSequence();
119
- this.currentSequence = null;
120
- this.info.valid = false;
121
- }
122
-
123
- /**
124
- * This method should be invoked when a new sequence starts
125
- * @param {module:bags/ActivitySequenceElement.ActivitySequenceElement} ase - The {@link module:bags/ActivitySequenceElement.ActivitySequenceElement ActivitySequenceElement} referenced by this sequence.
126
- */
127
- newSequence(ase) {
128
- this.endSequence();
129
- this.currentSequence = new _SequenceReg_js__WEBPACK_IMPORTED_MODULE_0__["default"](ase);
130
- this.sequences.push(this.currentSequence);
131
- this.info.valid = false;
132
- }
133
-
134
- /**
135
- * This method should be invoked when the user starts a new activity
136
- * @param {module:Activity.Activity} act - The {@link module:Activity.Activity Activity} that has just started
137
- */
138
- newActivity(act) {
139
- if (this.currentSequence) {
140
- // Save activity name if not yet registered
141
- if (this.actNames.indexOf(act.name) === -1)
142
- this.actNames.push(act.name);
143
- this.currentSequence.newActivity(act);
144
- this.info.valid = false;
145
- }
146
- }
147
-
148
- /**
149
- * This method should be called when the current activity finishes. Data about user's final results
150
- * on the activity will then be saved.
151
- * @param {number} score - The final score, usually in a 0-100 scale.
152
- * @param {number} numActions - The total number of actions done by the user to solve the activity
153
- * @param {boolean} solved - `true` if the activity was finally solved, `false` otherwise.
154
- */
155
- endActivity(score, numActions, solved) {
156
- if (this.currentSequence) {
157
- this.currentSequence.endActivity(score, numActions, solved);
158
- this.info.valid = false;
159
- }
160
- }
161
-
162
- /**
163
- * Reports a new action done by the user while playing the current activity
164
- * @param {string} type - Type of action (`click`, `write`, `move`, `select`...)
165
- * @param {string}+ source - Description of the object on which the action is done.
166
- * @param {string}+ dest - Description of the object that acts as a target of the action (used in pairings)
167
- * @param {boolean} ok - `true` if the action was OK, `false`, `null` or `undefined` otherwise
168
- */
169
- newAction(type, source, dest, ok) {
170
- if (this.currentSequence) {
171
- this.currentSequence.newAction(type, source, dest, ok);
172
- this.info.valid = false;
173
- }
174
- }
175
-
176
- /**
177
- * Gets the name of the current sequence
178
- * @returns {string}
179
- */
180
- getCurrentSequenceTag() {
181
- return this.currentSequence ? this.currentSequence.name : null;
182
- }
183
-
184
- /**
185
- * Gets information about the current sequence
186
- * @returns {module:report/SequenceReg.SequenceRegInfo}
187
- */
188
- getCurrentSequenceInfo() {
189
- return this.currentSequence ? this.currentSequence.getInfo() : null;
190
- }
191
- }
192
-
193
- Object.assign(SessionReg.prototype, {
194
- /**
195
- * Number of activities suitable to be reported in this session
196
- * @name module:report/SessionReg.SessionReg#reportableActs
197
- * @type {number} */
198
- reportableActs: 0,
199
- /**
200
- * Array with unique names of the activities being reported in this session
201
- * @name module:report/SessionReg.SessionReg#actNames
202
- * @type {string[]} */
203
- actNames: null,
204
- /**
205
- * List of sequences done in this session
206
- * @name module:report/SessionReg.SessionReg#sequences
207
- * @type {module:report/SequenceReg.SequenceReg[]} */
208
- sequences: null,
209
- /**
210
- * The sequence currently active
211
- * @name module:report/SessionReg.SessionReg#currentSequence
212
- * @type {module:report/SequenceReg.SequenceReg} */
213
- currentSequence: null,
214
- /**
215
- * Starting date and time of this session
216
- * @name module:report/SessionReg.SessionReg#started
217
- * @type {external:Date} */
218
- started: null,
219
- /**
220
- * Name of the {@link module:project/JClicProject.JClicProject JClicProject} associated to this session
221
- * @name module:report/SessionReg.SessionReg#projectName
222
- * @type {string} */
223
- projectName: '',
224
- /**
225
- * Current session info
226
- * @name module:report/SessionReg.SessionReg#info
227
- * @type {module:report/SessionReg.SessionRegInfo} */
228
- info: null,
229
- /**
230
- * Optional code to be used with this session
231
- * @name module:report/SessionReg.SessionReg#code
232
- * @type {string} */
233
- code: null,
234
- });
235
-
236
- /**
237
- * This object stores the global results of a {@link module:report/SessionReg.SessionReg SessionReg}
238
- */
239
- class SessionRegInfo {
240
- /**
241
- * SessionRegInfo constructor
242
- * @param {module:report/SessionReg.SessionReg} sReg - The {@link module:report/SessionReg.SessionReg SessionReg} associated tho this `Info` object.
243
- */
244
- constructor(sReg) {
245
- this.sReg = sReg;
246
- }
247
-
248
- /**
249
- * Clears all data associated with this working session
250
- */
251
- clear() {
252
- this.numSequences = this.nActivities = this.nActSolved = this.nActScore = 0;
253
- this.ratioSolved = this.ratioPlayed = this.nActions = this.tScore = this.tTime = 0;
254
- this.valid = false;
255
- }
256
-
257
- /**
258
- * Computes the value of all global variables based on the data stored in `sequences`
259
- * @returns {module:report/SessionReg.SessionRegInfo} - This "info" object
260
- */
261
- recalc() {
262
- if (!this.valid) {
263
- this.clear();
264
- this.sReg.sequences.forEach(sr => {
265
- const sri = sr.getInfo();
266
- if (sri.nActivities > 0) {
267
- this.numSequences++;
268
- if (sri.nActClosed > 0) {
269
- this.nActivities += sri.nActClosed;
270
- this.nActions += sri.nActions;
271
- if (sri.nActScore > 0) {
272
- this.nActScore += sri.nActScore;
273
- this.tScore += sri.tScore * sri.nActScore;
274
- }
275
- this.tTime += sri.tTime;
276
- this.nActSolved += sri.nActSolved;
277
- }
278
- }
279
- });
280
- if (this.nActScore > 0)
281
- this.tScore = Math.round(this.tScore / this.nActScore);
282
- if (this.nActivities > 0) {
283
- this.ratioSolved = this.nActSolved / this.nActivities;
284
- if (this.sReg.reportableActs > 0)
285
- this.ratioPlayed = this.sReg.actNames.length / this.sReg.reportableActs;
286
- }
287
- this.valid = true;
288
- }
289
- return this;
290
- }
291
- }
292
-
293
- Object.assign(SessionRegInfo.prototype, {
294
- /**
295
- * The SessionReg linked to this Info object
296
- * @name module:report/SessionReg.SessionRegInfo#sReg
297
- * @type {module:report/SessionReg.SessionReg} */
298
- sReg: null,
299
- /**
300
- * When `false`, this session info needs to be recalculated
301
- * @name module:report/SessionReg.SessionRegInfo#valid
302
- * @type {boolean} */
303
- valid: false,
304
- /**
305
- * Number of sequences played
306
- * @name module:report/SessionReg.SessionRegInfo#numSequences
307
- * @type {number} */
308
- numSequences: 0,
309
- /**
310
- * Number of activities played
311
- * @name module:report/SessionReg.SessionRegInfo#nActivities
312
- * @type {number} */
313
- nActivities: 0,
314
- /**
315
- * Number of activities solved
316
- * @name module:report/SessionReg.SessionRegInfo#nActSolved
317
- * @type {number} */
318
- nActSolved: 0,
319
- /**
320
- * Number of activities with score > 0
321
- * @name module:report/SessionReg.SessionRegInfo#nActScore
322
- * @type {number} */
323
- nActScore: 0,
324
- /**
325
- * Percentage of solved activities
326
- * @name module:report/SessionReg.SessionRegInfo#ratioSolved
327
- * @type {number} */
328
- ratioSolved: 0,
329
- /**
330
- * Percentage of reportable activities played
331
- * @name module:report/SessionReg.SessionRegInfo#ratioPlayed
332
- * @type {number} */
333
- ratioPlayed: 0,
334
- /**
335
- * Number of actions done by the user while in this working session
336
- * @name module:report/SessionReg.SessionRegInfo#nActions
337
- * @type {number} */
338
- nActions: 0,
339
- /**
340
- * Sum of the scores of all the activities played
341
- * @name module:report/SessionReg.SessionRegInfo#tScore
342
- * @type {number} */
343
- tScore: 0,
344
- /**
345
- * Sum of the playing time reported by each activity (not always equals to the session's total time)
346
- * @name module:report/SessionReg.SessionRegInfo#tTime
347
- * @type {number} */
348
- tTime: 0,
349
- });
350
-
351
- SessionReg.Info = SessionRegInfo;
352
-
353
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SessionReg);
354
-
355
-
356
- /***/ })
357
-
358
- };
359
- ;
360
- //# sourceMappingURL=8641.jclic-node.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"8641.jclic-node.js","mappings":";;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAE2C;;AAE3C;AACA,6FAA6F;AAC7F,oDAAoD,yDAAyD;AAC7G;AACO;AACP;AACA;AACA,aAAa,0CAA0C;AACvD,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB,uDAAuD,yDAAyD;AAChH,aAAa,SAAS;AACtB,eAAe,QAAQ;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,6DAA6D,WAAW,2FAA2F;AAChL;AACA;AACA;AACA,+BAA+B,uDAAW;AAC1C;AACA;AACA;;AAEA;AACA;AACA,aAAa,0BAA0B,WAAW,yCAAyC;AAC3F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,UAAU;AACtB;AACA;AACA;AACA;AACA,YAAY,yCAAyC;AACrD;AACA;AACA;AACA;AACA,YAAY,uCAAuC;AACnD;AACA;AACA;AACA;AACA,YAAY,eAAe;AAC3B;AACA;AACA,kBAAkB,6DAA6D;AAC/E;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,yCAAyC;AACrD;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA,CAAC;;AAED;AACA,+CAA+C;AAC/C;AACO;AACP;AACA;AACA,aAAa,qCAAqC,YAAY,sDAAsD;AACpH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,yCAAyC;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,qCAAqC;AACjD;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA,CAAC;;AAED;;AAEA,iEAAe,UAAU,EAAC","sources":["webpack://jclic/./src/report/SessionReg.js"],"sourcesContent":["/**\n * File : report/SessionReg.js\n * Created : 17/05/2016\n * By : Francesc Busquets <francesc@gmail.com>\n *\n * JClic.js\n * An HTML5 player of JClic activities\n * https://projectestac.github.io/jclic.js\n *\n * @source https://github.com/projectestac/jclic.js\n *\n * @license EUPL-1.2\n * @licstart\n * (c) 2000-2020 Catalan Educational Telematic Network (XTEC)\n *\n * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by\n * the European Commission- subsequent versions of the EUPL (the \"Licence\");\n * You may not use this work except in compliance with the Licence.\n *\n * You may obtain a copy of the Licence at:\n * https://joinup.ec.europa.eu/software/page/eupl\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the Licence is distributed on an \"AS IS\" basis, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * Licence for the specific language governing permissions and limitations\n * under the Licence.\n * @licend\n * @module\n */\n\nimport SequenceReg from './SequenceReg.js';\n\n/**\n * This class encapsulates data of a user's working session, usually associated to a single {@link module:project/JClicProject.JClicProject JClicProject}\n * It's main component is `sequences`, an array of {@link module:report/SequenceReg.SequenceReg SequenceReg} objects.\n */\nexport class SessionReg {\n /**\n * SessionReg constructor\n * @param {module:project/JClicProject.JClicProject} project - The JClicProject referenced by this session.\n * @param {string} [code] - Optional code to be used by this SessionReg\n */\n constructor(project, code) {\n this.projectName = project.name;\n this.code = code || project.code;\n this.sequences = [];\n this.actNames = [];\n this.started = new Date();\n this.info = new SessionRegInfo(this);\n this.reportableActs = project.reportableActs;\n }\n\n /**\n * Builds a complex object with the results of all activities done during this working session\n * @param {boolean} recalcInfo - When `true`, global variables (number of sequences, score, total time...)\n * will be recalculated from the data stored in the {@link module:report/SequenceReg.SequenceReg SequenceReg} objects.\n * @param {boolean} includeEmpty - When `true`, sequences without reported activities will be also included in the results\n * @returns {object} - An object containing the full session data\n */\n getData(recalcInfo, includeEmpty) {\n if (recalcInfo)\n this.info.recalc();\n\n const result = {\n projectName: this.projectName,\n played: this.info.nActivities,\n ratioPlayed: Math.round(this.info.ratioPlayed * 100),\n solved: this.info.nActSolved,\n ratioSolved: Math.round(this.info.ratioSolved * 100),\n actions: this.info.nActions,\n score: this.info.tScore,\n time: Math.round(this.info.tTime / 10) / 100,\n sequences: []\n };\n\n this.sequences.forEach(s => {\n const seq = s.getData();\n if (includeEmpty || seq.activities.length > 0)\n result.sequences.push(seq);\n });\n return result;\n }\n\n /**\n * Returns the `info` element associated to this SessionReg.\n * @returns {module:report/SessionReg.SessionRegInfo}\n */\n getInfo() {\n return this.info.recalc();\n }\n\n /**\n * Closes this session\n */\n end() {\n this.endSequence();\n }\n\n /**\n * This method should be called when the current working session finishes.\n */\n endSequence() {\n if (this.currentSequence && this.currentSequence.totalTime === 0)\n this.currentSequence.endSequence();\n this.currentSequence = null;\n this.info.valid = false;\n }\n\n /**\n * This method should be invoked when a new sequence starts\n * @param {module:bags/ActivitySequenceElement.ActivitySequenceElement} ase - The {@link module:bags/ActivitySequenceElement.ActivitySequenceElement ActivitySequenceElement} referenced by this sequence.\n */\n newSequence(ase) {\n this.endSequence();\n this.currentSequence = new SequenceReg(ase);\n this.sequences.push(this.currentSequence);\n this.info.valid = false;\n }\n\n /**\n * This method should be invoked when the user starts a new activity\n * @param {module:Activity.Activity} act - The {@link module:Activity.Activity Activity} that has just started\n */\n newActivity(act) {\n if (this.currentSequence) {\n // Save activity name if not yet registered\n if (this.actNames.indexOf(act.name) === -1)\n this.actNames.push(act.name);\n this.currentSequence.newActivity(act);\n this.info.valid = false;\n }\n }\n\n /**\n * This method should be called when the current activity finishes. Data about user's final results\n * on the activity will then be saved.\n * @param {number} score - The final score, usually in a 0-100 scale.\n * @param {number} numActions - The total number of actions done by the user to solve the activity\n * @param {boolean} solved - `true` if the activity was finally solved, `false` otherwise.\n */\n endActivity(score, numActions, solved) {\n if (this.currentSequence) {\n this.currentSequence.endActivity(score, numActions, solved);\n this.info.valid = false;\n }\n }\n\n /**\n * Reports a new action done by the user while playing the current activity\n * @param {string} type - Type of action (`click`, `write`, `move`, `select`...)\n * @param {string}+ source - Description of the object on which the action is done.\n * @param {string}+ dest - Description of the object that acts as a target of the action (used in pairings)\n * @param {boolean} ok - `true` if the action was OK, `false`, `null` or `undefined` otherwise\n */\n newAction(type, source, dest, ok) {\n if (this.currentSequence) {\n this.currentSequence.newAction(type, source, dest, ok);\n this.info.valid = false;\n }\n }\n\n /**\n * Gets the name of the current sequence\n * @returns {string}\n */\n getCurrentSequenceTag() {\n return this.currentSequence ? this.currentSequence.name : null;\n }\n\n /**\n * Gets information about the current sequence\n * @returns {module:report/SequenceReg.SequenceRegInfo}\n */\n getCurrentSequenceInfo() {\n return this.currentSequence ? this.currentSequence.getInfo() : null;\n }\n}\n\nObject.assign(SessionReg.prototype, {\n /**\n * Number of activities suitable to be reported in this session\n * @name module:report/SessionReg.SessionReg#reportableActs\n * @type {number} */\n reportableActs: 0,\n /**\n * Array with unique names of the activities being reported in this session\n * @name module:report/SessionReg.SessionReg#actNames\n * @type {string[]} */\n actNames: null,\n /**\n * List of sequences done in this session\n * @name module:report/SessionReg.SessionReg#sequences\n * @type {module:report/SequenceReg.SequenceReg[]} */\n sequences: null,\n /**\n * The sequence currently active\n * @name module:report/SessionReg.SessionReg#currentSequence\n * @type {module:report/SequenceReg.SequenceReg} */\n currentSequence: null,\n /**\n * Starting date and time of this session\n * @name module:report/SessionReg.SessionReg#started\n * @type {external:Date} */\n started: null,\n /**\n * Name of the {@link module:project/JClicProject.JClicProject JClicProject} associated to this session\n * @name module:report/SessionReg.SessionReg#projectName\n * @type {string} */\n projectName: '',\n /**\n * Current session info\n * @name module:report/SessionReg.SessionReg#info\n * @type {module:report/SessionReg.SessionRegInfo} */\n info: null,\n /**\n * Optional code to be used with this session\n * @name module:report/SessionReg.SessionReg#code\n * @type {string} */\n code: null,\n});\n\n/**\n * This object stores the global results of a {@link module:report/SessionReg.SessionReg SessionReg}\n */\nexport class SessionRegInfo {\n /**\n * SessionRegInfo constructor\n * @param {module:report/SessionReg.SessionReg} sReg - The {@link module:report/SessionReg.SessionReg SessionReg} associated tho this `Info` object.\n */\n constructor(sReg) {\n this.sReg = sReg;\n }\n\n /**\n * Clears all data associated with this working session\n */\n clear() {\n this.numSequences = this.nActivities = this.nActSolved = this.nActScore = 0;\n this.ratioSolved = this.ratioPlayed = this.nActions = this.tScore = this.tTime = 0;\n this.valid = false;\n }\n\n /**\n * Computes the value of all global variables based on the data stored in `sequences`\n * @returns {module:report/SessionReg.SessionRegInfo} - This \"info\" object\n */\n recalc() {\n if (!this.valid) {\n this.clear();\n this.sReg.sequences.forEach(sr => {\n const sri = sr.getInfo();\n if (sri.nActivities > 0) {\n this.numSequences++;\n if (sri.nActClosed > 0) {\n this.nActivities += sri.nActClosed;\n this.nActions += sri.nActions;\n if (sri.nActScore > 0) {\n this.nActScore += sri.nActScore;\n this.tScore += sri.tScore * sri.nActScore;\n }\n this.tTime += sri.tTime;\n this.nActSolved += sri.nActSolved;\n }\n }\n });\n if (this.nActScore > 0)\n this.tScore = Math.round(this.tScore / this.nActScore);\n if (this.nActivities > 0) {\n this.ratioSolved = this.nActSolved / this.nActivities;\n if (this.sReg.reportableActs > 0)\n this.ratioPlayed = this.sReg.actNames.length / this.sReg.reportableActs;\n }\n this.valid = true;\n }\n return this;\n }\n}\n\nObject.assign(SessionRegInfo.prototype, {\n /**\n * The SessionReg linked to this Info object\n * @name module:report/SessionReg.SessionRegInfo#sReg\n * @type {module:report/SessionReg.SessionReg} */\n sReg: null,\n /**\n * When `false`, this session info needs to be recalculated\n * @name module:report/SessionReg.SessionRegInfo#valid\n * @type {boolean} */\n valid: false,\n /**\n * Number of sequences played\n * @name module:report/SessionReg.SessionRegInfo#numSequences\n * @type {number} */\n numSequences: 0,\n /**\n * Number of activities played\n * @name module:report/SessionReg.SessionRegInfo#nActivities\n * @type {number} */\n nActivities: 0,\n /**\n * Number of activities solved\n * @name module:report/SessionReg.SessionRegInfo#nActSolved\n * @type {number} */\n nActSolved: 0,\n /**\n * Number of activities with score > 0\n * @name module:report/SessionReg.SessionRegInfo#nActScore\n * @type {number} */\n nActScore: 0,\n /**\n * Percentage of solved activities\n * @name module:report/SessionReg.SessionRegInfo#ratioSolved\n * @type {number} */\n ratioSolved: 0,\n /**\n * Percentage of reportable activities played\n * @name module:report/SessionReg.SessionRegInfo#ratioPlayed\n * @type {number} */\n ratioPlayed: 0,\n /**\n * Number of actions done by the user while in this working session\n * @name module:report/SessionReg.SessionRegInfo#nActions\n * @type {number} */\n nActions: 0,\n /**\n * Sum of the scores of all the activities played\n * @name module:report/SessionReg.SessionRegInfo#tScore\n * @type {number} */\n tScore: 0,\n /**\n * Sum of the playing time reported by each activity (not always equals to the session's total time)\n * @name module:report/SessionReg.SessionRegInfo#tTime\n * @type {number} */\n tTime: 0,\n});\n\nSessionReg.Info = SessionRegInfo;\n\nexport default SessionReg;\n"],"names":[],"sourceRoot":""}