@coorpacademy/app-review 0.1.21-alpha.8 → 0.1.21
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/es/index.js +4 -1
- package/es/services/index.js +5 -3
- package/es/test/util/services.mock.js +66 -4
- package/es/types/common.d.ts +1 -0
- package/lib/index.js +4 -1
- package/lib/services/index.js +5 -3
- package/lib/test/util/services.mock.js +67 -4
- package/lib/types/common.d.ts +1 -0
- package/package.json +4 -4
- package/src/index.tsx +6 -1
- package/src/services/index.ts +5 -3
- package/src/test/util/services.mock.ts +68 -4
- package/src/types/common.ts +6 -0
package/es/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { useSelector, useDispatch, Provider } from 'react-redux';
|
|
3
3
|
import AppReviewTemplate from '@coorpacademy/components/es/template/app-review';
|
|
4
|
+
import { TemplateContext } from '@coorpacademy/components/es/template/app-review/template-context';
|
|
4
5
|
import isEmpty from 'lodash/fp/isEmpty';
|
|
5
6
|
import get from 'lodash/fp/get';
|
|
6
7
|
import configureStore from './configure-store';
|
|
@@ -65,7 +66,9 @@ const AppReview = ({ options }) => {
|
|
|
65
66
|
}, [isProgressionCreated, options, store]);
|
|
66
67
|
if (!store)
|
|
67
68
|
return null;
|
|
69
|
+
const { templateContext: values } = options;
|
|
68
70
|
return (React.createElement(Provider, { store: store },
|
|
69
|
-
React.createElement(
|
|
71
|
+
React.createElement(TemplateContext, { values: values },
|
|
72
|
+
React.createElement(ConnectedApp, null))));
|
|
70
73
|
};
|
|
71
74
|
export default AppReview;
|
package/es/services/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { fetchCorrection } from './fetch-correction';
|
|
1
2
|
import { fetchSkills } from './fetch-skills';
|
|
2
|
-
import { postProgression } from './post-progression';
|
|
3
3
|
import { fetchSlide } from './fetch-slide';
|
|
4
4
|
import { postAnswer } from './post-answer';
|
|
5
|
+
import { postProgression } from './post-progression';
|
|
5
6
|
export const getServices = () => ({
|
|
7
|
+
fetchCorrection,
|
|
6
8
|
fetchSkills,
|
|
7
9
|
fetchSlide,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
postAnswer,
|
|
11
|
+
postProgression
|
|
10
12
|
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import get from 'lodash/fp/get';
|
|
2
|
-
import { qcmDragSlide } from '../../views/slides/test/fixtures/qcm-drag';
|
|
3
2
|
import { qcmSlide } from '../../views/slides/test/fixtures/qcm';
|
|
4
3
|
import { qcmGraphicSlide } from '../../views/slides/test/fixtures/qcm-graphic';
|
|
5
4
|
import { freeTextSlide } from '../../views/slides/test/fixtures/free-text';
|
|
@@ -22,8 +21,6 @@ const getSlideFixture = (ref) => {
|
|
|
22
21
|
return freeTextSlide;
|
|
23
22
|
case templateSlide.universalRef:
|
|
24
23
|
return templateSlide;
|
|
25
|
-
case qcmDragSlide.universalRef:
|
|
26
|
-
return qcmDragSlide;
|
|
27
24
|
default:
|
|
28
25
|
return sliderSlide;
|
|
29
26
|
}
|
|
@@ -330,6 +327,70 @@ export const progressionSlideWithPendingSlide = {
|
|
|
330
327
|
stars: 32
|
|
331
328
|
}
|
|
332
329
|
};
|
|
330
|
+
const getChoicesCorrection = (ref, wrongChoice = false) => {
|
|
331
|
+
switch (ref) {
|
|
332
|
+
case qcmSlide.universalRef: {
|
|
333
|
+
const correctAnswer = [get('question.content.choices.0.label', qcmSlide)];
|
|
334
|
+
return {
|
|
335
|
+
correctAnswer,
|
|
336
|
+
corrections: wrongChoice
|
|
337
|
+
? [
|
|
338
|
+
{
|
|
339
|
+
answer: get('question.content.choices.2.label', qcmSlide),
|
|
340
|
+
isCorrect: false
|
|
341
|
+
}
|
|
342
|
+
]
|
|
343
|
+
: [{ answer: correctAnswer[0], isCorrect: true }]
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
case qcmGraphicSlide.universalRef: {
|
|
347
|
+
const correctAnswer = [get('question.content.choices.1.label', qcmGraphicSlide)];
|
|
348
|
+
return {
|
|
349
|
+
correctAnswer,
|
|
350
|
+
corrections: wrongChoice
|
|
351
|
+
? [{ answer: get('question.content.choices.0.label', qcmGraphicSlide), isCorrect: false }]
|
|
352
|
+
: [{ answer: correctAnswer[0], isCorrect: true }]
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
case freeTextSlide.universalRef: {
|
|
356
|
+
const correctAnswer = ['Benchmark'];
|
|
357
|
+
return {
|
|
358
|
+
correctAnswer,
|
|
359
|
+
corrections: wrongChoice
|
|
360
|
+
? [{ answer: 'Nope', isCorrect: false }]
|
|
361
|
+
: [{ answer: correctAnswer[0], isCorrect: true }]
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
case templateSlide.universalRef: {
|
|
365
|
+
const correctAnswer = [get('question.content.choices.1.items.1.text', templateSlide)];
|
|
366
|
+
return {
|
|
367
|
+
correctAnswer,
|
|
368
|
+
corrections: wrongChoice
|
|
369
|
+
? [
|
|
370
|
+
{
|
|
371
|
+
answer: get('question.content.choices.1.items.0.text', templateSlide),
|
|
372
|
+
isCorrect: false
|
|
373
|
+
}
|
|
374
|
+
]
|
|
375
|
+
: [{ answer: correctAnswer[0], isCorrect: true }]
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
default: {
|
|
379
|
+
const correctAnswer = ['7', '7 ans'];
|
|
380
|
+
return {
|
|
381
|
+
correctAnswer,
|
|
382
|
+
corrections: wrongChoice
|
|
383
|
+
? [
|
|
384
|
+
{
|
|
385
|
+
answer: '8',
|
|
386
|
+
isCorrect: false
|
|
387
|
+
}
|
|
388
|
+
]
|
|
389
|
+
: [{ answer: '7', isCorrect: true }]
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
};
|
|
333
394
|
export const services = {
|
|
334
395
|
fetchSkills: () => Promise.resolve(fetchSkillsResponse),
|
|
335
396
|
fetchSlide: ref => Promise.resolve({ ...getSlideFixture(ref), universalRef: ref, id: ref }),
|
|
@@ -337,5 +398,6 @@ export const services = {
|
|
|
337
398
|
postAnswer: progression => {
|
|
338
399
|
const currentSlide = progression.state.nextContent.ref;
|
|
339
400
|
return Promise.resolve(get(currentSlide, postAnswerResponses));
|
|
340
|
-
}
|
|
401
|
+
},
|
|
402
|
+
fetchCorrection: ref => Promise.resolve(getChoicesCorrection(ref))
|
|
341
403
|
};
|
package/es/types/common.d.ts
CHANGED
|
@@ -129,6 +129,7 @@ export declare type Services = {
|
|
|
129
129
|
fetchSlide(slideRef: string, token: string): Promise<SlideFromAPI | void>;
|
|
130
130
|
postProgression(skillRef: string, token: string): Promise<ProgressionFromAPI>;
|
|
131
131
|
postAnswer(progression: ProgressionFromAPI, token: string, answer: string[]): Promise<ProgressionFromAPI>;
|
|
132
|
+
fetchCorrection(slideRef: string, token: string, progressionId: string, answer: string[]): Promise<CorrectionFromAPI | void>;
|
|
132
133
|
};
|
|
133
134
|
export declare type Options = {
|
|
134
135
|
services: Services;
|
package/lib/index.js
CHANGED
|
@@ -12,6 +12,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import React, { useEffect, useState } from 'react';
|
|
13
13
|
import { useSelector, useDispatch, Provider } from 'react-redux';
|
|
14
14
|
import AppReviewTemplate from '@coorpacademy/components/es/template/app-review';
|
|
15
|
+
import { TemplateContext } from '@coorpacademy/components/es/template/app-review/template-context';
|
|
15
16
|
import isEmpty from 'lodash/fp/isEmpty';
|
|
16
17
|
import get from 'lodash/fp/get';
|
|
17
18
|
import configureStore from './configure-store';
|
|
@@ -77,7 +78,9 @@ var AppReview = function (_a) {
|
|
|
77
78
|
}, [isProgressionCreated, options, store]);
|
|
78
79
|
if (!store)
|
|
79
80
|
return null;
|
|
81
|
+
var values = options.templateContext;
|
|
80
82
|
return (React.createElement(Provider, { store: store },
|
|
81
|
-
React.createElement(
|
|
83
|
+
React.createElement(TemplateContext, { values: values },
|
|
84
|
+
React.createElement(ConnectedApp, null))));
|
|
82
85
|
};
|
|
83
86
|
export default AppReview;
|
package/lib/services/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { fetchCorrection } from './fetch-correction';
|
|
1
2
|
import { fetchSkills } from './fetch-skills';
|
|
2
|
-
import { postProgression } from './post-progression';
|
|
3
3
|
import { fetchSlide } from './fetch-slide';
|
|
4
4
|
import { postAnswer } from './post-answer';
|
|
5
|
+
import { postProgression } from './post-progression';
|
|
5
6
|
export var getServices = function () { return ({
|
|
7
|
+
fetchCorrection: fetchCorrection,
|
|
6
8
|
fetchSkills: fetchSkills,
|
|
7
9
|
fetchSlide: fetchSlide,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
postAnswer: postAnswer,
|
|
11
|
+
postProgression: postProgression
|
|
10
12
|
}); };
|
|
@@ -11,7 +11,6 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
var _a;
|
|
13
13
|
import get from 'lodash/fp/get';
|
|
14
|
-
import { qcmDragSlide } from '../../views/slides/test/fixtures/qcm-drag';
|
|
15
14
|
import { qcmSlide } from '../../views/slides/test/fixtures/qcm';
|
|
16
15
|
import { qcmGraphicSlide } from '../../views/slides/test/fixtures/qcm-graphic';
|
|
17
16
|
import { freeTextSlide } from '../../views/slides/test/fixtures/free-text';
|
|
@@ -34,8 +33,6 @@ var getSlideFixture = function (ref) {
|
|
|
34
33
|
return freeTextSlide;
|
|
35
34
|
case templateSlide.universalRef:
|
|
36
35
|
return templateSlide;
|
|
37
|
-
case qcmDragSlide.universalRef:
|
|
38
|
-
return qcmDragSlide;
|
|
39
36
|
default:
|
|
40
37
|
return sliderSlide;
|
|
41
38
|
}
|
|
@@ -342,6 +339,71 @@ export var progressionSlideWithPendingSlide = {
|
|
|
342
339
|
stars: 32
|
|
343
340
|
}
|
|
344
341
|
};
|
|
342
|
+
var getChoicesCorrection = function (ref, wrongChoice) {
|
|
343
|
+
if (wrongChoice === void 0) { wrongChoice = false; }
|
|
344
|
+
switch (ref) {
|
|
345
|
+
case qcmSlide.universalRef: {
|
|
346
|
+
var correctAnswer = [get('question.content.choices.0.label', qcmSlide)];
|
|
347
|
+
return {
|
|
348
|
+
correctAnswer: correctAnswer,
|
|
349
|
+
corrections: wrongChoice
|
|
350
|
+
? [
|
|
351
|
+
{
|
|
352
|
+
answer: get('question.content.choices.2.label', qcmSlide),
|
|
353
|
+
isCorrect: false
|
|
354
|
+
}
|
|
355
|
+
]
|
|
356
|
+
: [{ answer: correctAnswer[0], isCorrect: true }]
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
case qcmGraphicSlide.universalRef: {
|
|
360
|
+
var correctAnswer = [get('question.content.choices.1.label', qcmGraphicSlide)];
|
|
361
|
+
return {
|
|
362
|
+
correctAnswer: correctAnswer,
|
|
363
|
+
corrections: wrongChoice
|
|
364
|
+
? [{ answer: get('question.content.choices.0.label', qcmGraphicSlide), isCorrect: false }]
|
|
365
|
+
: [{ answer: correctAnswer[0], isCorrect: true }]
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
case freeTextSlide.universalRef: {
|
|
369
|
+
var correctAnswer = ['Benchmark'];
|
|
370
|
+
return {
|
|
371
|
+
correctAnswer: correctAnswer,
|
|
372
|
+
corrections: wrongChoice
|
|
373
|
+
? [{ answer: 'Nope', isCorrect: false }]
|
|
374
|
+
: [{ answer: correctAnswer[0], isCorrect: true }]
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
case templateSlide.universalRef: {
|
|
378
|
+
var correctAnswer = [get('question.content.choices.1.items.1.text', templateSlide)];
|
|
379
|
+
return {
|
|
380
|
+
correctAnswer: correctAnswer,
|
|
381
|
+
corrections: wrongChoice
|
|
382
|
+
? [
|
|
383
|
+
{
|
|
384
|
+
answer: get('question.content.choices.1.items.0.text', templateSlide),
|
|
385
|
+
isCorrect: false
|
|
386
|
+
}
|
|
387
|
+
]
|
|
388
|
+
: [{ answer: correctAnswer[0], isCorrect: true }]
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
default: {
|
|
392
|
+
var correctAnswer = ['7', '7 ans'];
|
|
393
|
+
return {
|
|
394
|
+
correctAnswer: correctAnswer,
|
|
395
|
+
corrections: wrongChoice
|
|
396
|
+
? [
|
|
397
|
+
{
|
|
398
|
+
answer: '8',
|
|
399
|
+
isCorrect: false
|
|
400
|
+
}
|
|
401
|
+
]
|
|
402
|
+
: [{ answer: '7', isCorrect: true }]
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
};
|
|
345
407
|
export var services = {
|
|
346
408
|
fetchSkills: function () { return Promise.resolve(fetchSkillsResponse); },
|
|
347
409
|
fetchSlide: function (ref) { return Promise.resolve(__assign(__assign({}, getSlideFixture(ref)), { universalRef: ref, id: ref })); },
|
|
@@ -349,5 +411,6 @@ export var services = {
|
|
|
349
411
|
postAnswer: function (progression) {
|
|
350
412
|
var currentSlide = progression.state.nextContent.ref;
|
|
351
413
|
return Promise.resolve(get(currentSlide, postAnswerResponses));
|
|
352
|
-
}
|
|
414
|
+
},
|
|
415
|
+
fetchCorrection: function (ref) { return Promise.resolve(getChoicesCorrection(ref)); }
|
|
353
416
|
};
|
package/lib/types/common.d.ts
CHANGED
|
@@ -129,6 +129,7 @@ export declare type Services = {
|
|
|
129
129
|
fetchSlide(slideRef: string, token: string): Promise<SlideFromAPI | void>;
|
|
130
130
|
postProgression(skillRef: string, token: string): Promise<ProgressionFromAPI>;
|
|
131
131
|
postAnswer(progression: ProgressionFromAPI, token: string, answer: string[]): Promise<ProgressionFromAPI>;
|
|
132
|
+
fetchCorrection(slideRef: string, token: string, progressionId: string, answer: string[]): Promise<CorrectionFromAPI | void>;
|
|
132
133
|
};
|
|
133
134
|
export declare type Options = {
|
|
134
135
|
services: Services;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coorpacademy/app-review",
|
|
3
|
-
"version": "0.1.21
|
|
3
|
+
"version": "0.1.21",
|
|
4
4
|
"description": "",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=16.15.0"
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"./package.json": "./package.json"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@coorpacademy/components": "10.22.15
|
|
45
|
-
"@coorpacademy/redux-task": "1.1.5",
|
|
44
|
+
"@coorpacademy/components": "10.22.15",
|
|
45
|
+
"@coorpacademy/redux-task": "^1.1.5",
|
|
46
46
|
"cross-fetch": "^3.1.5",
|
|
47
47
|
"jwt-decode": "^3.1.2",
|
|
48
48
|
"react-redux": "^8.0.1",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"ts-node": "^10.9.1",
|
|
79
79
|
"typescript": "^4.7.4"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "c1783083ab70ca3ccbeebb029a521470457212c8"
|
|
82
82
|
}
|
package/src/index.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import type {} from 'redux-thunk/extend-redux'; // https://github.com/reduxjs/re
|
|
|
3
3
|
import {AnyAction, Store} from 'redux';
|
|
4
4
|
import {useSelector, useDispatch, Provider} from 'react-redux';
|
|
5
5
|
import AppReviewTemplate from '@coorpacademy/components/es/template/app-review';
|
|
6
|
+
import {TemplateContext} from '@coorpacademy/components/es/template/app-review/template-context';
|
|
6
7
|
|
|
7
8
|
import isEmpty from 'lodash/fp/isEmpty';
|
|
8
9
|
import get from 'lodash/fp/get';
|
|
@@ -86,9 +87,13 @@ const AppReview = ({options}: {options: AppOptions}): JSX.Element | null => {
|
|
|
86
87
|
|
|
87
88
|
if (!store) return null;
|
|
88
89
|
|
|
90
|
+
const {templateContext: values} = options;
|
|
91
|
+
|
|
89
92
|
return (
|
|
90
93
|
<Provider store={store}>
|
|
91
|
-
<
|
|
94
|
+
<TemplateContext values={values}>
|
|
95
|
+
<ConnectedApp />
|
|
96
|
+
</TemplateContext>
|
|
92
97
|
</Provider>
|
|
93
98
|
);
|
|
94
99
|
};
|
package/src/services/index.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import {Services} from '../types/common';
|
|
2
|
+
import {fetchCorrection} from './fetch-correction';
|
|
2
3
|
import {fetchSkills} from './fetch-skills';
|
|
3
|
-
import {postProgression} from './post-progression';
|
|
4
4
|
import {fetchSlide} from './fetch-slide';
|
|
5
5
|
import {postAnswer} from './post-answer';
|
|
6
|
+
import {postProgression} from './post-progression';
|
|
6
7
|
|
|
7
8
|
export const getServices = (): Services => ({
|
|
9
|
+
fetchCorrection,
|
|
8
10
|
fetchSkills,
|
|
9
11
|
fetchSlide,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
postAnswer,
|
|
13
|
+
postProgression
|
|
12
14
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import get from 'lodash/fp/get';
|
|
2
|
-
import {qcmDragSlide} from '../../views/slides/test/fixtures/qcm-drag';
|
|
3
2
|
import {qcmSlide} from '../../views/slides/test/fixtures/qcm';
|
|
4
3
|
import {qcmGraphicSlide} from '../../views/slides/test/fixtures/qcm-graphic';
|
|
5
4
|
import {freeTextSlide} from '../../views/slides/test/fixtures/free-text';
|
|
6
5
|
import {sliderSlide} from '../../views/slides/test/fixtures/slider';
|
|
7
6
|
import {templateSlide} from '../../views/slides/test/fixtures/template';
|
|
8
7
|
import {
|
|
8
|
+
CorrectionFromAPI,
|
|
9
9
|
ProgressionFromAPI,
|
|
10
10
|
ReviewContent,
|
|
11
11
|
ReviewEngine,
|
|
@@ -32,8 +32,6 @@ const getSlideFixture = (ref: string): SlideFromAPI => {
|
|
|
32
32
|
return freeTextSlide;
|
|
33
33
|
case templateSlide.universalRef:
|
|
34
34
|
return templateSlide;
|
|
35
|
-
case qcmDragSlide.universalRef:
|
|
36
|
-
return qcmDragSlide;
|
|
37
35
|
default:
|
|
38
36
|
return sliderSlide;
|
|
39
37
|
}
|
|
@@ -345,6 +343,71 @@ export const progressionSlideWithPendingSlide: ProgressionFromAPI = {
|
|
|
345
343
|
}
|
|
346
344
|
};
|
|
347
345
|
|
|
346
|
+
const getChoicesCorrection = (ref: string, wrongChoice = false): CorrectionFromAPI => {
|
|
347
|
+
switch (ref) {
|
|
348
|
+
case qcmSlide.universalRef: {
|
|
349
|
+
const correctAnswer = [get('question.content.choices.0.label', qcmSlide)];
|
|
350
|
+
return {
|
|
351
|
+
correctAnswer,
|
|
352
|
+
corrections: wrongChoice
|
|
353
|
+
? [
|
|
354
|
+
{
|
|
355
|
+
answer: get('question.content.choices.2.label', qcmSlide),
|
|
356
|
+
isCorrect: false
|
|
357
|
+
}
|
|
358
|
+
]
|
|
359
|
+
: [{answer: correctAnswer[0], isCorrect: true}]
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
case qcmGraphicSlide.universalRef: {
|
|
363
|
+
const correctAnswer = [get('question.content.choices.1.label', qcmGraphicSlide)];
|
|
364
|
+
return {
|
|
365
|
+
correctAnswer,
|
|
366
|
+
corrections: wrongChoice
|
|
367
|
+
? [{answer: get('question.content.choices.0.label', qcmGraphicSlide), isCorrect: false}]
|
|
368
|
+
: [{answer: correctAnswer[0], isCorrect: true}]
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
case freeTextSlide.universalRef: {
|
|
372
|
+
const correctAnswer = ['Benchmark'];
|
|
373
|
+
return {
|
|
374
|
+
correctAnswer,
|
|
375
|
+
corrections: wrongChoice
|
|
376
|
+
? [{answer: 'Nope', isCorrect: false}]
|
|
377
|
+
: [{answer: correctAnswer[0], isCorrect: true}]
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
case templateSlide.universalRef: {
|
|
381
|
+
const correctAnswer = [get('question.content.choices.1.items.1.text', templateSlide)];
|
|
382
|
+
return {
|
|
383
|
+
correctAnswer,
|
|
384
|
+
corrections: wrongChoice
|
|
385
|
+
? [
|
|
386
|
+
{
|
|
387
|
+
answer: get('question.content.choices.1.items.0.text', templateSlide),
|
|
388
|
+
isCorrect: false
|
|
389
|
+
}
|
|
390
|
+
]
|
|
391
|
+
: [{answer: correctAnswer[0], isCorrect: true}]
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
default: {
|
|
395
|
+
const correctAnswer = ['7', '7 ans'];
|
|
396
|
+
return {
|
|
397
|
+
correctAnswer,
|
|
398
|
+
corrections: wrongChoice
|
|
399
|
+
? [
|
|
400
|
+
{
|
|
401
|
+
answer: '8',
|
|
402
|
+
isCorrect: false
|
|
403
|
+
}
|
|
404
|
+
]
|
|
405
|
+
: [{answer: '7', isCorrect: true}]
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
|
|
348
411
|
export const services: Services = {
|
|
349
412
|
fetchSkills: () => Promise.resolve(fetchSkillsResponse),
|
|
350
413
|
fetchSlide: ref => Promise.resolve({...getSlideFixture(ref), universalRef: ref, id: ref}),
|
|
@@ -352,5 +415,6 @@ export const services: Services = {
|
|
|
352
415
|
postAnswer: progression => {
|
|
353
416
|
const currentSlide = progression.state.nextContent.ref;
|
|
354
417
|
return Promise.resolve(get(currentSlide, postAnswerResponses));
|
|
355
|
-
}
|
|
418
|
+
},
|
|
419
|
+
fetchCorrection: ref => Promise.resolve(getChoicesCorrection(ref))
|
|
356
420
|
};
|
package/src/types/common.ts
CHANGED
|
@@ -157,6 +157,12 @@ export type Services = {
|
|
|
157
157
|
token: string,
|
|
158
158
|
answer: string[]
|
|
159
159
|
): Promise<ProgressionFromAPI>;
|
|
160
|
+
fetchCorrection(
|
|
161
|
+
slideRef: string,
|
|
162
|
+
token: string,
|
|
163
|
+
progressionId: string,
|
|
164
|
+
answer: string[]
|
|
165
|
+
): Promise<CorrectionFromAPI | void>;
|
|
160
166
|
};
|
|
161
167
|
|
|
162
168
|
export type Options = {
|