@pie-element/hotspot 6.12.1-next.33 → 6.12.1-next.43
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/controller/lib/utils.js
CHANGED
|
@@ -25,9 +25,12 @@ exports.getCorrectResponse = getCorrectResponse;
|
|
|
25
25
|
|
|
26
26
|
var isResponseCorrect = function isResponseCorrect(question, session) {
|
|
27
27
|
var _question$shapes = question.shapes,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
_question$shapes$rect = _question$shapes.rectangles,
|
|
29
|
+
rectangles = _question$shapes$rect === void 0 ? [] : _question$shapes$rect,
|
|
30
|
+
_question$shapes$poly = _question$shapes.polygons,
|
|
31
|
+
polygons = _question$shapes$poly === void 0 ? [] : _question$shapes$poly,
|
|
32
|
+
_question$shapes$circ = _question$shapes.circles,
|
|
33
|
+
circles = _question$shapes$circ === void 0 ? [] : _question$shapes$circ;
|
|
31
34
|
var choices = [].concat((0, _toConsumableArray2["default"])(rectangles), (0, _toConsumableArray2["default"])(polygons), (0, _toConsumableArray2["default"])(circles));
|
|
32
35
|
var correctResponseIds = getCorrectResponse(choices);
|
|
33
36
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils.js"],"names":["getCorrectResponse","choices","filter","c","correct","map","id","sort","isResponseCorrect","question","session","shapes","rectangles","polygons","circles","correctResponseIds","answers","length","answerIds","a"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEO,IAAMA,kBAAkB,GAAG,SAArBA,kBAAqB,CAACC,OAAD;AAAA,SAChCA,OAAO,CACJC,MADH,CACU,UAACC,CAAD;AAAA,WAAOA,CAAC,CAACC,OAAT;AAAA,GADV,EAEGC,GAFH,CAEO,UAACF,CAAD;AAAA,WAAOA,CAAC,CAACG,EAAT;AAAA,GAFP,EAGGC,IAHH,EADgC;AAAA,CAA3B;;;;AAMA,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,QAAD,EAAWC,OAAX,EAAuB;AACtD,yBAEID,QAFJ,CACEE,MADF;AAAA,
|
|
1
|
+
{"version":3,"sources":["../src/utils.js"],"names":["getCorrectResponse","choices","filter","c","correct","map","id","sort","isResponseCorrect","question","session","shapes","rectangles","polygons","circles","correctResponseIds","answers","length","answerIds","a"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEO,IAAMA,kBAAkB,GAAG,SAArBA,kBAAqB,CAACC,OAAD;AAAA,SAChCA,OAAO,CACJC,MADH,CACU,UAACC,CAAD;AAAA,WAAOA,CAAC,CAACC,OAAT;AAAA,GADV,EAEGC,GAFH,CAEO,UAACF,CAAD;AAAA,WAAOA,CAAC,CAACG,EAAT;AAAA,GAFP,EAGGC,IAHH,EADgC;AAAA,CAA3B;;;;AAMA,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,QAAD,EAAWC,OAAX,EAAuB;AACtD,yBAEID,QAFJ,CACEE,MADF;AAAA,+CACYC,UADZ;AAAA,MACYA,UADZ,sCACyB,EADzB;AAAA,+CAC6BC,QAD7B;AAAA,MAC6BA,QAD7B,sCACwC,EADxC;AAAA,+CAC4CC,OAD5C;AAAA,MAC4CA,OAD5C,sCACsD,EADtD;AAGA,MAAMb,OAAO,iDAAOW,UAAP,uCAAsBC,QAAtB,uCAAmCC,OAAnC,EAAb;AACA,MAAIC,kBAAkB,GAAGf,kBAAkB,CAACC,OAAD,CAA3C;;AAEA,MAAI,CAACS,OAAD,IAAY,yBAAQA,OAAR,CAAhB,EAAkC;AAChC,WAAO,KAAP;AACD;;AAED,MAAIA,OAAO,CAACM,OAAR,IAAmBN,OAAO,CAACM,OAAR,CAAgBC,MAAvC,EAA+C;AAC7C,QAAIC,SAAS,GAAG,CAACR,OAAO,CAACM,OAAR,IAAmB,EAApB,EAAwBX,GAAxB,CAA4B,UAACc,CAAD;AAAA,aAAOA,CAAC,CAACb,EAAT;AAAA,KAA5B,CAAhB;AAEA,WAAO,yBAAQY,SAAS,CAACX,IAAV,EAAR,EAA0BQ,kBAA1B,CAAP;AACD,GAJD,MAIO,IAAI,EAAEA,kBAAkB,IAAIA,kBAAkB,CAACE,MAA3C,CAAJ,EAAwD;AAC7D,WAAO,IAAP;AACD;;AAED,SAAO,KAAP;AACD,CApBM","sourcesContent":["import isEqual from 'lodash/isEqual';\nimport isEmpty from 'lodash/isEmpty';\n\nexport const getCorrectResponse = (choices) =>\n choices\n .filter((c) => c.correct)\n .map((c) => c.id)\n .sort();\n\nexport const isResponseCorrect = (question, session) => {\n const {\n shapes: { rectangles = [], polygons = [], circles = [] },\n } = question;\n const choices = [...rectangles, ...polygons, ...circles];\n let correctResponseIds = getCorrectResponse(choices);\n\n if (!session || isEmpty(session)) {\n return false;\n }\n\n if (session.answers && session.answers.length) {\n let answerIds = (session.answers || []).map((a) => a.id);\n\n return isEqual(answerIds.sort(), correctResponseIds);\n } else if (!(correctResponseIds && correctResponseIds.length)) {\n return true;\n }\n\n return false;\n};\n"],"file":"utils.js"}
|
package/controller/src/utils.js
CHANGED
|
@@ -9,7 +9,7 @@ export const getCorrectResponse = (choices) =>
|
|
|
9
9
|
|
|
10
10
|
export const isResponseCorrect = (question, session) => {
|
|
11
11
|
const {
|
|
12
|
-
shapes: { rectangles, polygons, circles },
|
|
12
|
+
shapes: { rectangles = [], polygons = [], circles = [] },
|
|
13
13
|
} = question;
|
|
14
14
|
const choices = [...rectangles, ...polygons, ...circles];
|
|
15
15
|
let correctResponseIds = getCorrectResponse(choices);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/hotspot",
|
|
3
|
-
"version": "6.12.1-next.
|
|
3
|
+
"version": "6.12.1-next.43+9e3c59b3e",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": "pie-framework/pie-elements",
|
|
6
6
|
"publishConfig": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"author": "pie framework developers",
|
|
20
20
|
"license": "ISC",
|
|
21
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "9e3c59b3e3daacce248e754dc10bfffc09f06a0d",
|
|
22
22
|
"scripts": {
|
|
23
23
|
"postpublish": "../../scripts/postpublish"
|
|
24
24
|
},
|