fcad-core-dragon 2.0.0-beta.1 → 2.0.0-beta.10
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/.editorconfig +6 -31
- package/.prettierrc +11 -0
- package/.vscode/extensions.json +8 -0
- package/.vscode/settings.json +16 -0
- package/CHANGELOG +153 -0
- package/README.md +28 -43
- package/documentation/.vitepress/config.js +114 -0
- package/documentation/api-examples.md +49 -0
- package/documentation/composants/app-base-button.md +58 -0
- package/documentation/composants/app-base-error-display.md +59 -0
- package/documentation/composants/app-base-popover.md +68 -0
- package/documentation/composants/app-comp-audio.md +75 -0
- package/documentation/composants/app-comp-branch-buttons.md +111 -0
- package/documentation/composants/app-comp-button-progress.md +53 -0
- package/documentation/composants/app-comp-carousel.md +53 -0
- package/documentation/composants/app-comp-container.md +53 -0
- package/documentation/composants/app-comp-input-checkbox-next.md +42 -0
- package/documentation/composants/app-comp-input-dropdown-next.md +34 -0
- package/documentation/composants/app-comp-input-radio-next.md +39 -0
- package/documentation/composants/app-comp-input-text-next.md +35 -0
- package/documentation/composants/app-comp-input-text-table-next.md +34 -0
- package/documentation/composants/app-comp-input-text-to-fill-dropdown-next.md +53 -0
- package/documentation/composants/app-comp-input-text-to-fill-next.md +31 -0
- package/documentation/composants/app-comp-jauge.md +31 -0
- package/documentation/composants/app-comp-menu-item.md +55 -0
- package/documentation/composants/app-comp-menu.md +29 -0
- package/documentation/composants/app-comp-navigation.md +41 -0
- package/documentation/composants/app-comp-note-call.md +53 -0
- package/documentation/composants/app-comp-note-credit.md +53 -0
- package/documentation/composants/app-comp-play-bar-next.md +53 -0
- package/documentation/composants/app-comp-pop-up-next.md +93 -0
- package/documentation/composants/app-comp-quiz-next.md +235 -0
- package/documentation/composants/app-comp-quiz-recall.md +53 -0
- package/documentation/composants/app-comp-svg-next.md +53 -0
- package/documentation/composants/app-comp-table-of-content.md +50 -0
- package/documentation/composants/app-comp-video-player.md +82 -0
- package/documentation/composants.md +46 -0
- package/documentation/composants_critiques/ModelPageComposant.md +53 -0
- package/documentation/composants_critiques/app-base-module.md +43 -0
- package/documentation/composants_critiques/app-base-page.md +48 -0
- package/documentation/composants_critiques/app-base.md +311 -0
- package/documentation/composants_critiques/main.md +15 -0
- package/documentation/demarrage.md +50 -0
- package/documentation/deploiement.md +58 -0
- package/documentation/index.md +33 -0
- package/documentation/markdown-examples.md +85 -0
- package/documentation/public/npm_version.png +0 -0
- package/documentation/public/vite.svg +15 -0
- package/documentation/public/vuejs.svg +2 -0
- package/documentation/public/vuetify.svg +6 -0
- package/eslint.config.js +60 -0
- package/package.json +43 -47
- package/src/$locales/en.json +86 -108
- package/src/$locales/fr.json +66 -127
- package/src/assets/data/onboardingMessages.json +1 -1
- package/src/components/AppBase.vue +960 -405
- package/src/components/AppBaseButton.test.js +21 -0
- package/src/components/AppBaseButton.vue +42 -10
- package/src/components/AppBaseErrorDisplay.vue +207 -189
- package/src/components/AppBaseFlipCard.vue +1 -0
- package/src/components/AppBaseModule.vue +769 -977
- package/src/components/AppBasePage.vue +635 -81
- package/src/components/AppBasePopover.vue +41 -0
- package/src/components/AppBaseSkeleton.vue +66 -0
- package/src/components/AppCompAudio.vue +256 -0
- package/src/components/AppCompBranchButtons.vue +79 -153
- package/src/components/AppCompButtonProgress.vue +21 -36
- package/src/components/AppCompCarousel.vue +231 -87
- package/src/components/{AppCompTranscript.vue → AppCompContainer.vue} +12 -2
- package/src/components/AppCompInputCheckBoxNx.vue +323 -0
- package/src/components/AppCompInputDropdownNx.vue +299 -0
- package/src/components/AppCompInputRadioNx.vue +284 -0
- package/src/components/AppCompInputTextNx.vue +153 -0
- package/src/components/AppCompInputTextTableNx.vue +202 -0
- package/src/components/AppCompInputTextToFillDropdownNx.vue +340 -0
- package/src/components/AppCompInputTextToFillNx.vue +313 -0
- package/src/components/AppCompJauge.vue +36 -10
- package/src/components/AppCompMenu.vue +246 -32
- package/src/components/AppCompMenuItem.vue +87 -21
- package/src/components/AppCompNavigation.vue +470 -447
- package/src/components/AppCompNoteCall.vue +93 -58
- package/src/components/AppCompNoteCredit.vue +423 -96
- package/src/components/AppCompPlayBarNext.vue +2288 -0
- package/src/components/AppCompPopUpNext.vue +504 -0
- package/src/components/AppCompQuizNext.vue +510 -0
- package/src/components/AppCompQuizRecall.vue +199 -99
- package/src/components/AppCompSVGNext.vue +346 -0
- package/src/components/AppCompSettingsMenu.vue +17 -16
- package/src/components/AppCompTableOfContent.vue +262 -99
- package/src/components/AppCompVideoPlayer.vue +183 -142
- package/src/components/BaseModule.vue +8 -20
- package/src/components/tests__/AppBaseButton.spec.js +53 -0
- package/src/components/tests__/useTimer.spec.js +91 -0
- package/src/composables/useIdleDetector.js +56 -0
- package/src/composables/useQuiz.js +89 -0
- package/src/composables/useTimer.js +172 -0
- package/src/directives/nvdaFix.js +53 -0
- package/src/externalComps/ModuleView.vue +22 -0
- package/src/externalComps/SummaryView.vue +91 -0
- package/src/main.js +397 -148
- package/src/module/stores/appStore.js +947 -0
- package/src/module/xapi/ADL.js +241 -60
- package/src/module/xapi/Crypto/Hasher.js +8 -8
- package/src/module/xapi/Crypto/WordArray.js +6 -6
- package/src/module/xapi/Crypto/algorithms/BufferedBlockAlgorithm.js +4 -4
- package/src/module/xapi/Crypto/algorithms/C_algo.js +14 -18
- package/src/module/xapi/Crypto/algorithms/HMAC.js +1 -1
- package/src/module/xapi/Crypto/algorithms/SHA1.js +1 -1
- package/src/module/xapi/Crypto/encoders/Base.js +7 -7
- package/src/module/xapi/Crypto/encoders/Base64.js +3 -3
- package/src/module/xapi/Crypto/encoders/Hex.js +2 -2
- package/src/module/xapi/Crypto/encoders/Latin1.js +3 -3
- package/src/module/xapi/Crypto/encoders/Utf8.js +3 -3
- package/src/module/xapi/Statement/index.js +3 -3
- package/src/module/xapi/launch.js +10 -10
- package/src/module/xapi/utils.js +17 -17
- package/src/module/xapi/wrapper.js +219 -214
- package/src/module/xapi/xapiStatement.js +29 -29
- package/src/plugins/analytics.js +34 -0
- package/src/plugins/bus.js +7 -2
- package/src/plugins/gsap.js +5 -7
- package/src/plugins/helper.js +97 -34
- package/src/plugins/i18n.js +13 -18
- package/src/plugins/idb.js +45 -30
- package/src/plugins/save.js +1 -1
- package/src/plugins/scorm.js +15 -15
- package/src/plugins/xapi.js +2 -2
- package/src/public/index.html +22 -10
- package/src/router/index.js +29 -13
- package/src/router/routes.js +29 -54
- package/src/shared/generalfuncs.js +186 -30
- package/src/shared/validators.js +809 -40
- package/vitest.config.js +19 -0
- package/.eslintignore +0 -29
- package/.eslintrc.js +0 -86
- package/.prettierrc.js +0 -5
- package/babel.config.js +0 -3
- package/src/components/AppBaseDragChoice.vue +0 -91
- package/src/components/AppBaseDropZone.vue +0 -112
- package/src/components/AppCompBif.vue +0 -120
- package/src/components/AppCompDragAndDrop.vue +0 -339
- package/src/components/AppCompInputAssociation.vue +0 -332
- package/src/components/AppCompInputCheckBox.vue +0 -227
- package/src/components/AppCompInputDropdown.vue +0 -184
- package/src/components/AppCompInputRadio.vue +0 -169
- package/src/components/AppCompInputTextBox.vue +0 -91
- package/src/components/AppCompInputTextTable.vue +0 -155
- package/src/components/AppCompInputTextToFillDropdown.vue +0 -255
- package/src/components/AppCompInputTextToFillText.vue +0 -164
- package/src/components/AppCompMediaPlayer.vue +0 -397
- package/src/components/AppCompPlayBar.vue +0 -1319
- package/src/components/AppCompPopUp.vue +0 -522
- package/src/components/AppCompPopover.vue +0 -27
- package/src/components/AppCompQuiz.vue +0 -2989
- package/src/components/AppCompSVG.vue +0 -309
- package/src/mixins/$pageMixins.js +0 -459
- package/src/mixins/$quizMixins.js +0 -456
- package/src/mixins/timerMixin.js +0 -156
- package/src/module/store.js +0 -895
- package/src/plugins/timeManager.js +0 -77
- package/src/routes_bckp.js +0 -313
- package/src/routes_static.js +0 -344
- package/vue.config.js +0 -83
|
@@ -1,456 +0,0 @@
|
|
|
1
|
-
const $extendsQuiz = {
|
|
2
|
-
watch: {
|
|
3
|
-
/**
|
|
4
|
-
* @description used to call a validation
|
|
5
|
-
*/
|
|
6
|
-
quizSubmit(newValue) {
|
|
7
|
-
if (newValue == true) {
|
|
8
|
-
this.validateAnswers()
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
|
|
13
|
-
methods: {
|
|
14
|
-
/**
|
|
15
|
-
* @param {String} inputId
|
|
16
|
-
* @returns {Array} the class
|
|
17
|
-
*/
|
|
18
|
-
classInput(inputId) {
|
|
19
|
-
let theClass = []
|
|
20
|
-
|
|
21
|
-
switch (this.inputType) {
|
|
22
|
-
case 'choix_unique':
|
|
23
|
-
if (inputId == this.quizInputUnique) {
|
|
24
|
-
theClass.push('reponseSelectionner')
|
|
25
|
-
}
|
|
26
|
-
break
|
|
27
|
-
|
|
28
|
-
case 'choix_mult':
|
|
29
|
-
if (this.containsValue(this.quizInputMultiple, inputId)) {
|
|
30
|
-
theClass.push('reponseSelectionner')
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (this.showSolution) {
|
|
35
|
-
if (this.solution !== null) {
|
|
36
|
-
switch (this.inputType) {
|
|
37
|
-
case 'choix_unique':
|
|
38
|
-
if (inputId == this.solution) {
|
|
39
|
-
theClass.push('correct_answer')
|
|
40
|
-
} else {
|
|
41
|
-
theClass.push('wrong_answer')
|
|
42
|
-
}
|
|
43
|
-
break
|
|
44
|
-
|
|
45
|
-
case 'choix_mult':
|
|
46
|
-
if (this.containsValue(this.solution, inputId)) {
|
|
47
|
-
theClass.push('correct_answer')
|
|
48
|
-
} else {
|
|
49
|
-
theClass.push('wrong_answer')
|
|
50
|
-
}
|
|
51
|
-
break
|
|
52
|
-
|
|
53
|
-
case 'dropdown':
|
|
54
|
-
if (this.solution[inputId] == this.quizSelectedValue[inputId]) {
|
|
55
|
-
theClass.push('correct_answer')
|
|
56
|
-
} else {
|
|
57
|
-
theClass.push('wrong_answer')
|
|
58
|
-
}
|
|
59
|
-
break
|
|
60
|
-
|
|
61
|
-
case 'texte_troue_select':
|
|
62
|
-
if (typeof this.quizSelectedValue[inputId] !== 'undefined') {
|
|
63
|
-
if (
|
|
64
|
-
Object.values(this.solution[inputId])[0] ==
|
|
65
|
-
this.quizSelectedValue[inputId]
|
|
66
|
-
) {
|
|
67
|
-
theClass.push('correct_answer')
|
|
68
|
-
} else {
|
|
69
|
-
theClass.push('wrong_answer')
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
break
|
|
73
|
-
|
|
74
|
-
case 'reponse_ouverte':
|
|
75
|
-
if (this.solution == this.quizTextArea) {
|
|
76
|
-
theClass.push('correct_answer')
|
|
77
|
-
} else {
|
|
78
|
-
theClass.push('wrong_answer')
|
|
79
|
-
}
|
|
80
|
-
break
|
|
81
|
-
case 'texte_tableau':
|
|
82
|
-
if (
|
|
83
|
-
this.containsValue(
|
|
84
|
-
this.solution[inputId].reponse_value,
|
|
85
|
-
this.quizTextTableValue[inputId]
|
|
86
|
-
)
|
|
87
|
-
) {
|
|
88
|
-
theClass.push('correct_answer')
|
|
89
|
-
} else {
|
|
90
|
-
theClass.push('wrong_answer')
|
|
91
|
-
}
|
|
92
|
-
break
|
|
93
|
-
case 'texte_troue':
|
|
94
|
-
if (typeof this.quizTextTableValue[inputId] !== 'undefined') {
|
|
95
|
-
if (
|
|
96
|
-
this.containsValue(
|
|
97
|
-
Object.values(this.solution[inputId])[0],
|
|
98
|
-
this.quizTextTableValue[inputId]
|
|
99
|
-
)
|
|
100
|
-
) {
|
|
101
|
-
theClass.push('correct_answer')
|
|
102
|
-
} else {
|
|
103
|
-
theClass.push('wrong_answer')
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
break
|
|
107
|
-
case 'association':
|
|
108
|
-
if (
|
|
109
|
-
this.solution[inputId] == this.quizAssociationValue[inputId]
|
|
110
|
-
) {
|
|
111
|
-
theClass.push('correct_answer')
|
|
112
|
-
} else {
|
|
113
|
-
theClass.push('wrong_answer')
|
|
114
|
-
}
|
|
115
|
-
break
|
|
116
|
-
case 'dragdrop':
|
|
117
|
-
if (
|
|
118
|
-
this.solution &&
|
|
119
|
-
this.solution[inputId] &&
|
|
120
|
-
this.quizDragDropValue &&
|
|
121
|
-
this.quizDragDropValue[inputId]
|
|
122
|
-
) {
|
|
123
|
-
//remove sort if order is important
|
|
124
|
-
const solution = [...this.solution[inputId]].sort(function(
|
|
125
|
-
a,
|
|
126
|
-
b
|
|
127
|
-
) {
|
|
128
|
-
return a - b
|
|
129
|
-
})
|
|
130
|
-
const values = [...this.quizDragDropValue[inputId]].sort(
|
|
131
|
-
function(a, b) {
|
|
132
|
-
return a - b
|
|
133
|
-
}
|
|
134
|
-
)
|
|
135
|
-
if (this.isEqual(solution, values)) {
|
|
136
|
-
theClass.push('correct_answer')
|
|
137
|
-
} else {
|
|
138
|
-
theClass.push('wrong_answer')
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
return theClass
|
|
145
|
-
},
|
|
146
|
-
messageAccessibility(inputId) {
|
|
147
|
-
let mess = ''
|
|
148
|
-
if (this.showSolution) {
|
|
149
|
-
if (this.solution !== null) {
|
|
150
|
-
switch (this.inputType) {
|
|
151
|
-
case 'choix_unique':
|
|
152
|
-
if (inputId == this.solution) {
|
|
153
|
-
mess = `${this.$t('quizState.goodAnswer')}`
|
|
154
|
-
} else {
|
|
155
|
-
mess = `${this.$t('quizState.badAnswer')}`
|
|
156
|
-
}
|
|
157
|
-
break
|
|
158
|
-
|
|
159
|
-
case 'choix_mult':
|
|
160
|
-
if (this.containsValue(this.solution, inputId)) {
|
|
161
|
-
mess = `${this.$t('quizState.goodAnswer')}`
|
|
162
|
-
} else {
|
|
163
|
-
mess = `${this.$t('quizState.badAnswer')}`
|
|
164
|
-
}
|
|
165
|
-
break
|
|
166
|
-
|
|
167
|
-
case 'dropdown':
|
|
168
|
-
if (this.solution[inputId] == this.quizSelectedValue[inputId]) {
|
|
169
|
-
mess = `${this.$t('quizState.goodAnswer')}`
|
|
170
|
-
} else {
|
|
171
|
-
mess = `${this.$t('quizState.badAnswer')}`
|
|
172
|
-
}
|
|
173
|
-
break
|
|
174
|
-
|
|
175
|
-
case 'texte_troue_select':
|
|
176
|
-
if (typeof this.quizSelectedValue[inputId] !== 'undefined') {
|
|
177
|
-
if (
|
|
178
|
-
Object.values(this.solution[inputId])[0] ==
|
|
179
|
-
this.quizSelectedValue[inputId]
|
|
180
|
-
) {
|
|
181
|
-
mess = `${this.$t('quizState.goodAnswer')}`
|
|
182
|
-
} else {
|
|
183
|
-
mess = `${this.$t('quizState.badAnswer')}`
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
break
|
|
187
|
-
|
|
188
|
-
case 'reponse_ouverte':
|
|
189
|
-
if (this.solution == this.quizTextArea) {
|
|
190
|
-
mess = `${this.$t('quizState.goodAnswer')}`
|
|
191
|
-
} else {
|
|
192
|
-
mess = `${this.$t('quizState.badAnswer')}`
|
|
193
|
-
}
|
|
194
|
-
break
|
|
195
|
-
case 'texte_tableau':
|
|
196
|
-
if (
|
|
197
|
-
this.containsValue(
|
|
198
|
-
this.solution[inputId].reponse_value,
|
|
199
|
-
this.quizTextTableValue[inputId]
|
|
200
|
-
)
|
|
201
|
-
) {
|
|
202
|
-
mess = `${this.$t('quizState.goodAnswer')}`
|
|
203
|
-
} else {
|
|
204
|
-
mess = `${this.$t('quizState.badAnswer')}`
|
|
205
|
-
}
|
|
206
|
-
break
|
|
207
|
-
case 'texte_troue':
|
|
208
|
-
if (typeof this.quizTextTableValue[inputId] !== 'undefined') {
|
|
209
|
-
if (
|
|
210
|
-
this.containsValue(
|
|
211
|
-
Object.values(this.solution[inputId])[0],
|
|
212
|
-
this.quizTextTableValue[inputId]
|
|
213
|
-
)
|
|
214
|
-
) {
|
|
215
|
-
mess = `${this.$t('quizState.goodAnswer')}`
|
|
216
|
-
} else {
|
|
217
|
-
mess = `${this.$t('quizState.badAnswer')}`
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
break
|
|
221
|
-
case 'association':
|
|
222
|
-
if (
|
|
223
|
-
this.solution[inputId] == this.quizAssociationValue[inputId]
|
|
224
|
-
) {
|
|
225
|
-
mess = `${this.$t('quizState.goodAnswer')}`
|
|
226
|
-
} else {
|
|
227
|
-
mess = `${this.$t('quizState.badAnswer')}`
|
|
228
|
-
}
|
|
229
|
-
break
|
|
230
|
-
case 'dragdrop':
|
|
231
|
-
if (
|
|
232
|
-
this.solution &&
|
|
233
|
-
this.solution[inputId] &&
|
|
234
|
-
this.quizDragDropValue &&
|
|
235
|
-
this.quizDragDropValue[inputId]
|
|
236
|
-
) {
|
|
237
|
-
//remove sort if order is important
|
|
238
|
-
const solution = [...this.solution[inputId]].sort(function(
|
|
239
|
-
a,
|
|
240
|
-
b
|
|
241
|
-
) {
|
|
242
|
-
return a - b
|
|
243
|
-
})
|
|
244
|
-
const values = [...this.quizDragDropValue[inputId]].sort(
|
|
245
|
-
function(a, b) {
|
|
246
|
-
return a - b
|
|
247
|
-
}
|
|
248
|
-
)
|
|
249
|
-
if (this.isEqual(solution, values)) {
|
|
250
|
-
mess = `${this.$t('quizState.goodAnswer')}`
|
|
251
|
-
} else {
|
|
252
|
-
mess = `${this.$t('quizState.badAnswer')}`
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
return mess
|
|
259
|
-
},
|
|
260
|
-
/**
|
|
261
|
-
* @description check if this question is correct
|
|
262
|
-
* @fires quiz-submit to AppCompQuiz.vue
|
|
263
|
-
*/
|
|
264
|
-
validateAnswers() {
|
|
265
|
-
let theAnswer = {}
|
|
266
|
-
|
|
267
|
-
switch (this.inputType) {
|
|
268
|
-
case 'choix_unique': {
|
|
269
|
-
let listInput = this.quizInputUnique
|
|
270
|
-
if (listInput) {
|
|
271
|
-
theAnswer = {
|
|
272
|
-
[this.inputDataId]: listInput
|
|
273
|
-
}
|
|
274
|
-
} else {
|
|
275
|
-
//did not answered
|
|
276
|
-
theAnswer = null
|
|
277
|
-
}
|
|
278
|
-
break
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
case 'choix_mult': {
|
|
282
|
-
let listInputCheck = this.quizInputMultiple
|
|
283
|
-
if (listInputCheck.length > 0) {
|
|
284
|
-
theAnswer = {
|
|
285
|
-
[this.inputDataId]: listInputCheck
|
|
286
|
-
}
|
|
287
|
-
} else {
|
|
288
|
-
//did not answered
|
|
289
|
-
theAnswer = null
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
break
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
case 'dropdown': {
|
|
296
|
-
let listQuizSelected = this.quizSelected
|
|
297
|
-
|
|
298
|
-
if (
|
|
299
|
-
listQuizSelected.length == this.inputData.length &&
|
|
300
|
-
!this.containsValue(listQuizSelected, null)
|
|
301
|
-
) {
|
|
302
|
-
let listQuizSelectedConvert = []
|
|
303
|
-
for (let index = 0; index < this.inputData.length; index++) {
|
|
304
|
-
const element = this.inputData[index]
|
|
305
|
-
listQuizSelectedConvert.push({
|
|
306
|
-
question_id: element.id,
|
|
307
|
-
reponse_id: listQuizSelected[index]
|
|
308
|
-
})
|
|
309
|
-
}
|
|
310
|
-
theAnswer = {
|
|
311
|
-
[this.inputDataId]: listQuizSelectedConvert
|
|
312
|
-
}
|
|
313
|
-
} else {
|
|
314
|
-
//did not answered
|
|
315
|
-
theAnswer = null
|
|
316
|
-
}
|
|
317
|
-
break
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
case 'texte_troue_select': {
|
|
321
|
-
const regex = /\$%\S*%\$/g // regex pattern to match exp: $%number%$
|
|
322
|
-
let matchAll = this.textBase.split(regex)
|
|
323
|
-
let listQuizSelectedText = this.quizSelected
|
|
324
|
-
if (
|
|
325
|
-
listQuizSelectedText.length == matchAll.length - 1 &&
|
|
326
|
-
!this.containsValue(listQuizSelectedText, null)
|
|
327
|
-
) {
|
|
328
|
-
let listQuizSelectedTextConvert = []
|
|
329
|
-
for (let index = 0; index < listQuizSelectedText.length; index++) {
|
|
330
|
-
listQuizSelectedTextConvert.push({
|
|
331
|
-
question_id: index,
|
|
332
|
-
reponse_id: listQuizSelectedText[index]
|
|
333
|
-
})
|
|
334
|
-
}
|
|
335
|
-
theAnswer = {
|
|
336
|
-
[this.inputDataId]: listQuizSelectedTextConvert
|
|
337
|
-
}
|
|
338
|
-
} else {
|
|
339
|
-
//did not answered
|
|
340
|
-
theAnswer = null
|
|
341
|
-
}
|
|
342
|
-
break
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
case 'reponse_ouverte': {
|
|
346
|
-
let listInputText = this.quizTextArea
|
|
347
|
-
if (listInputText.length > 0) {
|
|
348
|
-
theAnswer = {
|
|
349
|
-
[this.inputDataId]: listInputText
|
|
350
|
-
}
|
|
351
|
-
} else {
|
|
352
|
-
//did not answered
|
|
353
|
-
theAnswer = null
|
|
354
|
-
}
|
|
355
|
-
break
|
|
356
|
-
}
|
|
357
|
-
case 'texte_tableau': {
|
|
358
|
-
let listInputTextTable = this.quizTextTable
|
|
359
|
-
if (
|
|
360
|
-
listInputTextTable.length == this.inputData.length &&
|
|
361
|
-
!this.containsValue(listInputTextTable, null) &&
|
|
362
|
-
!this.containsValue(listInputTextTable, '')
|
|
363
|
-
) {
|
|
364
|
-
let listInputTextTableConvert = []
|
|
365
|
-
for (let index = 0; index < this.inputData.length; index++) {
|
|
366
|
-
const element = this.inputData[index]
|
|
367
|
-
listInputTextTableConvert.push({
|
|
368
|
-
question_id: element.id,
|
|
369
|
-
reponse: listInputTextTable[index]
|
|
370
|
-
})
|
|
371
|
-
}
|
|
372
|
-
theAnswer = {
|
|
373
|
-
[this.inputDataId]: listInputTextTableConvert
|
|
374
|
-
}
|
|
375
|
-
} else {
|
|
376
|
-
//did not answered
|
|
377
|
-
theAnswer = null
|
|
378
|
-
}
|
|
379
|
-
break
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
case 'texte_troue': {
|
|
383
|
-
const regex = /\$%\S*%\$/g // regex pattern to match exp: $%number%$
|
|
384
|
-
let matchAll = this.textBase.split(regex)
|
|
385
|
-
let listInputTextFill = this.quizTextTable
|
|
386
|
-
if (
|
|
387
|
-
listInputTextFill.length == matchAll.length - 1 &&
|
|
388
|
-
!this.containsValue(listInputTextFill, null) &&
|
|
389
|
-
!this.containsValue(listInputTextFill, '')
|
|
390
|
-
) {
|
|
391
|
-
let listInputTextFillConvert = []
|
|
392
|
-
for (let index = 0; index < listInputTextFill.length; index++) {
|
|
393
|
-
listInputTextFillConvert.push({
|
|
394
|
-
question_id: index,
|
|
395
|
-
reponse: listInputTextFill[index]
|
|
396
|
-
})
|
|
397
|
-
}
|
|
398
|
-
theAnswer = {
|
|
399
|
-
[this.inputDataId]: listInputTextFillConvert
|
|
400
|
-
}
|
|
401
|
-
} else {
|
|
402
|
-
//did not answered
|
|
403
|
-
theAnswer = null
|
|
404
|
-
}
|
|
405
|
-
break
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
case 'association': {
|
|
409
|
-
let listInputAssociation = this.quizAssociation
|
|
410
|
-
if (
|
|
411
|
-
Object.values(listInputAssociation).length ==
|
|
412
|
-
Object.values(this.solution).length &&
|
|
413
|
-
!this.containsValue(Object.values(listInputAssociation), '')
|
|
414
|
-
) {
|
|
415
|
-
theAnswer = {
|
|
416
|
-
[this.inputDataId]: listInputAssociation
|
|
417
|
-
}
|
|
418
|
-
} else {
|
|
419
|
-
//did not answered
|
|
420
|
-
theAnswer = null
|
|
421
|
-
}
|
|
422
|
-
break
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
case 'dragdrop': {
|
|
426
|
-
let listInputDragDrop = this.quizDragDrop
|
|
427
|
-
if (
|
|
428
|
-
Object.keys(listInputDragDrop).length ==
|
|
429
|
-
Object.keys(this.solution).length
|
|
430
|
-
) {
|
|
431
|
-
theAnswer = {
|
|
432
|
-
[this.inputDataId]: this.quizDragDrop
|
|
433
|
-
}
|
|
434
|
-
} else {
|
|
435
|
-
//did not answered
|
|
436
|
-
theAnswer = null
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
this.$emit('quiz-submit', theAnswer)
|
|
441
|
-
},
|
|
442
|
-
/**
|
|
443
|
-
* @description - Method to get the question
|
|
444
|
-
*/
|
|
445
|
-
getQuizQuestion() {
|
|
446
|
-
const el = document.querySelector(`#${this.aBy}`)
|
|
447
|
-
if (!el || !el.innerHTML) return
|
|
448
|
-
const labelFor =
|
|
449
|
-
this.$i18n.locale === 'fr'
|
|
450
|
-
? 'Choix de reponse pour la'
|
|
451
|
-
: 'Answers available for the'
|
|
452
|
-
return `${labelFor} ${el.innerText}`
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
export default $extendsQuiz
|
package/src/mixins/timerMixin.js
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
@ Description: Mixins to extends general fonctionnalities in a page of an activity. Add time tracker in activities
|
|
3
|
-
@ Note: .
|
|
4
|
-
*/
|
|
5
|
-
export const timerMixin = {
|
|
6
|
-
data() {
|
|
7
|
-
return {
|
|
8
|
-
lessonTimeCounter: 0,
|
|
9
|
-
activityTimeCounter: 0,
|
|
10
|
-
elapsedCounter: 0, // count the elapse time since lesson started
|
|
11
|
-
activityInterval: null,
|
|
12
|
-
lessonInterval: null,
|
|
13
|
-
fullInterval: null,
|
|
14
|
-
timerState: 'stopped',
|
|
15
|
-
elapsedInterval: null // interval of passed time since the lesson is started. used only for saving purposed
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
methods: {
|
|
19
|
-
/* Start the timer */
|
|
20
|
-
startTimer(op) {
|
|
21
|
-
if (op && !['activity', 'lesson'].includes(op))
|
|
22
|
-
throw new Error('this is not a valid option for the timer')
|
|
23
|
-
if (this.timerState === 'stopped') {
|
|
24
|
-
switch (op) {
|
|
25
|
-
case 'activity':
|
|
26
|
-
this.activityInterval = setInterval(() => {
|
|
27
|
-
this.activityTimeCounter += 1
|
|
28
|
-
}, 1000)
|
|
29
|
-
this.timerState = 'started'
|
|
30
|
-
|
|
31
|
-
break
|
|
32
|
-
|
|
33
|
-
case 'lesson':
|
|
34
|
-
this.lessonInterval = setInterval(() => {
|
|
35
|
-
this.lessonTimeCounter += 1
|
|
36
|
-
}, 1000)
|
|
37
|
-
break
|
|
38
|
-
|
|
39
|
-
default:
|
|
40
|
-
this.fullInterval = setInterval(() => {
|
|
41
|
-
this.activityTimeCounter += 1
|
|
42
|
-
this.lessonTimeCounter += 1
|
|
43
|
-
}, 1000)
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
/* Stop the timer and reset thimer to zero */
|
|
48
|
-
stopTimer(op) {
|
|
49
|
-
if (op && !['activity', 'lesson'].includes(op))
|
|
50
|
-
throw new Error('this is not a valid parameter')
|
|
51
|
-
|
|
52
|
-
if (this.timerState === 'started') {
|
|
53
|
-
if (op === 'activity' && this.activityTimeCounter > 0) {
|
|
54
|
-
this.lessonTimeCounter =
|
|
55
|
-
this.lessonTimeCounter + this.activityTimeCounter //add to the lesson counter
|
|
56
|
-
clearInterval(this.activityInterval) //clear the interval
|
|
57
|
-
this.activityTimeCounter = 0 // reset the counter
|
|
58
|
-
this.timerState = 'stopped'
|
|
59
|
-
} else if (op === 'lesson' && this.lessonTimeCounter > 0) {
|
|
60
|
-
clearInterval(this.lessonInterval)
|
|
61
|
-
this.lessonTimeCounter = 0
|
|
62
|
-
} else {
|
|
63
|
-
clearInterval(this.fullInterval)
|
|
64
|
-
clearInterval(this.elapsedCounter)
|
|
65
|
-
clearInterval(this.elapsedInterval)
|
|
66
|
-
|
|
67
|
-
this.activityTimeCounter = 0
|
|
68
|
-
this.lessonTimeCounter = 0
|
|
69
|
-
this.elapsedCounter = 0
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
/* Pause the timer but does not reset to zero*/
|
|
74
|
-
pauseTimer(op) {
|
|
75
|
-
if (op && !['activity', 'lesson'].includes(op))
|
|
76
|
-
throw new Error('this is not a valid parameter')
|
|
77
|
-
|
|
78
|
-
if (op === 'activity' && this.activityTimeCounter > 0) {
|
|
79
|
-
clearInterval(this.activityInterval)
|
|
80
|
-
} else if (op === 'lesson') {
|
|
81
|
-
clearInterval(this.lessonInterval)
|
|
82
|
-
} else {
|
|
83
|
-
clearInterval(this.fullInterval)
|
|
84
|
-
clearInterval(this.elapsedInterval)
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
|
|
88
|
-
/* Format seconds to ISO 8601 format */
|
|
89
|
-
formatToISOString(seconds) {
|
|
90
|
-
let d = new Date(null) //create a default date ref
|
|
91
|
-
d.setSeconds(seconds) //set the time with passed numbers of seconds
|
|
92
|
-
//Example of ISO 8601 time format of 24 chars: "1970-01-04T14:50:00.000Z"
|
|
93
|
-
let ISOTime = d.toISOString()
|
|
94
|
-
|
|
95
|
-
return ISOTime // YYYY-MM-DDTHH:mm:ss.sssZ
|
|
96
|
-
},
|
|
97
|
-
|
|
98
|
-
/* Parse a ISO string time period to the format of HH:mm:ss */
|
|
99
|
-
ISOTimeParser(seconds) {
|
|
100
|
-
let ISOTimePeriod = this.formatToISOString(seconds).substring(8, 19) // only the time portion of it
|
|
101
|
-
ISOTimePeriod = ISOTimePeriod.split('T')
|
|
102
|
-
const DDToHrs = (parseInt(ISOTimePeriod[0]) - 1) * 24 // convert xxT to hrs
|
|
103
|
-
const periodOfTime = ISOTimePeriod[1] ? ISOTimePeriod[1].split(':') : null
|
|
104
|
-
|
|
105
|
-
if (!periodOfTime) return '00:00:00'
|
|
106
|
-
|
|
107
|
-
let timeString = ''
|
|
108
|
-
let HH = (DDToHrs + parseInt(periodOfTime[0])).toString()
|
|
109
|
-
let mm = periodOfTime[1]
|
|
110
|
-
let ss = periodOfTime[2]
|
|
111
|
-
|
|
112
|
-
if (HH.length === 1) HH = `0${HH}`
|
|
113
|
-
|
|
114
|
-
timeString = `${HH}:${mm}:${ss}`
|
|
115
|
-
|
|
116
|
-
return timeString
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
mounted() {
|
|
120
|
-
this.$bus.$on('start-timer', (op) => {
|
|
121
|
-
this.startTimer(op)
|
|
122
|
-
})
|
|
123
|
-
|
|
124
|
-
this.$bus.$on('stop-timer', (op) => {
|
|
125
|
-
this.stopTimer(op)
|
|
126
|
-
})
|
|
127
|
-
|
|
128
|
-
this.$bus.$on('pause-timer', (op) => {
|
|
129
|
-
this.pauseTimer(op)
|
|
130
|
-
})
|
|
131
|
-
|
|
132
|
-
this.elapsedInterval = setInterval(() => {
|
|
133
|
-
this.elapsedCounter += 1
|
|
134
|
-
}, 1000)
|
|
135
|
-
},
|
|
136
|
-
computed: {
|
|
137
|
-
activityDuration() {
|
|
138
|
-
let duration
|
|
139
|
-
if (this.activityTimeCounter > 0)
|
|
140
|
-
duration = this.ISOTimeParser(this.activityTimeCounter)
|
|
141
|
-
else duration = '00:00:00'
|
|
142
|
-
|
|
143
|
-
return duration
|
|
144
|
-
},
|
|
145
|
-
lessonDuration() {
|
|
146
|
-
this.lessonTimeCounter = this.lessonTimeCounter + this.activityTimeCounter
|
|
147
|
-
|
|
148
|
-
let duration = this.ISOTimeParser(this.lessonTimeCounter)
|
|
149
|
-
return duration
|
|
150
|
-
},
|
|
151
|
-
elapsedTime() {
|
|
152
|
-
const eTime = this.elapsedCounter
|
|
153
|
-
return eTime
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|