@pie-element/rubric 3.1.8-next.0 → 3.1.8-next.7
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/configure/lib/defaults.js +1 -1
- package/configure/lib/defaults.js.map +1 -1
- package/configure/src/defaults.js +1 -1
- package/controller/lib/index.js +7 -1
- package/controller/lib/index.js.map +1 -1
- package/controller/src/index.js +10 -6
- package/docs/demo/generate.js +1 -1
- package/module/configure.js +1 -1
- package/module/controller.js +7 -1
- package/module/demo.js +1 -1
- package/module/print-demo.js +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/defaults.js"],"names":["model","points","sampleAnswers","maxPoints","excludeZero","excludeZeroEnabled","maxPointsEnabled","configuration","showExcludeZero","settings","label","showMaxPoint","settingsPanelDisabled","mathMlOptions","mmlOutput","mmlEditing","maxMaxPoints"],"mappings":";;;;;;eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,MAAM,EAAE,CAAC,EAAD,EAAK,EAAL,EAAS,EAAT,EAAa,EAAb,CADH;AAELC,IAAAA,aAAa,EAAE,CAAC,IAAD,EAAO,IAAP,EAAa,IAAb,EAAmB,IAAnB,CAFV;AAGLC,IAAAA,SAAS,EAAE,CAHN;AAILC,IAAAA,WAAW,EAAE,KAJR;AAKLC,IAAAA,kBAAkB,EAAE,IALf;AAMLC,IAAAA,gBAAgB,EAAE;AANb,GADM;AASbC,EAAAA,aAAa,EAAE;AACbC,IAAAA,eAAe,EAAE;AACfC,MAAAA,QAAQ,EAAE,IADK;AAEfC,MAAAA,KAAK,EAAE;AAFQ,KADJ;AAKbC,IAAAA,YAAY,EAAE;AACZF,MAAAA,QAAQ,EAAE,IADE;AAEZC,MAAAA,KAAK,EAAE;AAFK,KALD;AASbE,IAAAA,qBAAqB,EAAE,KATV;AAUb;AACAC,IAAAA,aAAa,EAAE;AACbC,MAAAA,SAAS,EAAE,KADE;AAEbC,MAAAA,UAAU,EAAE;AAFC,KAXF;AAebC,IAAAA,YAAY,EAAE;AAfD;AATF,C","sourcesContent":["export default {\n model: {\n points: ['', '', '', ''],\n sampleAnswers: [null, null, null, null],\n maxPoints:
|
|
1
|
+
{"version":3,"sources":["../src/defaults.js"],"names":["model","points","sampleAnswers","maxPoints","excludeZero","excludeZeroEnabled","maxPointsEnabled","configuration","showExcludeZero","settings","label","showMaxPoint","settingsPanelDisabled","mathMlOptions","mmlOutput","mmlEditing","maxMaxPoints"],"mappings":";;;;;;eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,MAAM,EAAE,CAAC,EAAD,EAAK,EAAL,EAAS,EAAT,EAAa,EAAb,CADH;AAELC,IAAAA,aAAa,EAAE,CAAC,IAAD,EAAO,IAAP,EAAa,IAAb,EAAmB,IAAnB,CAFV;AAGLC,IAAAA,SAAS,EAAE,CAHN;AAILC,IAAAA,WAAW,EAAE,KAJR;AAKLC,IAAAA,kBAAkB,EAAE,IALf;AAMLC,IAAAA,gBAAgB,EAAE;AANb,GADM;AASbC,EAAAA,aAAa,EAAE;AACbC,IAAAA,eAAe,EAAE;AACfC,MAAAA,QAAQ,EAAE,IADK;AAEfC,MAAAA,KAAK,EAAE;AAFQ,KADJ;AAKbC,IAAAA,YAAY,EAAE;AACZF,MAAAA,QAAQ,EAAE,IADE;AAEZC,MAAAA,KAAK,EAAE;AAFK,KALD;AASbE,IAAAA,qBAAqB,EAAE,KATV;AAUb;AACAC,IAAAA,aAAa,EAAE;AACbC,MAAAA,SAAS,EAAE,KADE;AAEbC,MAAAA,UAAU,EAAE;AAFC,KAXF;AAebC,IAAAA,YAAY,EAAE;AAfD;AATF,C","sourcesContent":["export default {\n model: {\n points: ['', '', '', ''],\n sampleAnswers: [null, null, null, null],\n maxPoints: 3,\n excludeZero: false,\n excludeZeroEnabled: true,\n maxPointsEnabled: true,\n },\n configuration: {\n showExcludeZero: {\n settings: true,\n label: 'Ability to exclude zero',\n },\n showMaxPoint: {\n settings: true,\n label: 'Show max points dropdown',\n },\n settingsPanelDisabled: false,\n // width: '500px'\n mathMlOptions: {\n mmlOutput: false,\n mmlEditing: false,\n },\n maxMaxPoints: 9,\n },\n};\n"],"file":"defaults.js"}
|
package/controller/lib/index.js
CHANGED
|
@@ -19,10 +19,16 @@ function markupToText(s) {
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
function validate(model, config) {
|
|
22
|
-
var points = model.points
|
|
22
|
+
var points = model.points,
|
|
23
|
+
excludeZero = model.excludeZero;
|
|
23
24
|
var errors = {};
|
|
24
25
|
var pointsDescriptorsErrors = {};
|
|
25
26
|
(points || []).forEach(function (point, index) {
|
|
27
|
+
if (index === 0 && excludeZero) {
|
|
28
|
+
// if excludeZero is true, the 0 point is not displayed, so it should not be validated
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
26
32
|
if (!point || point === '<div></div>') {
|
|
27
33
|
pointsDescriptorsErrors[index] = 'Points descriptors cannot be empty.';
|
|
28
34
|
} else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["model","session","env","Promise","resolve","modelResult","role","markupToText","s","replace","validate","config","points","errors","pointsDescriptorsErrors","forEach","point","index","identicalPointDescr","slice","some","p","Object","keys","length"],"mappings":";;;;;;;;AAAO,SAASA,KAAT,CAAeA,KAAf,EAAsBC,OAAtB,EAA+BC,GAA/B,EAAoC;AACzC,SAAO,IAAIC,OAAJ,CAAY,UAACC,OAAD,EAAa;AAC9B,QAAMC,WAAW,GAAG,CAACL,KAAD,GAAS,EAAT,GAAcA,KAAlC;AACAI,IAAAA,OAAO,CAACF,GAAG,IAAIA,GAAG,CAACI,IAAX,IAAmBJ,GAAG,CAACI,IAAJ,KAAa,YAAhC,GAA+CD,WAA/C,GAA6D,EAA9D,CAAP;AACD,GAHM,CAAP;AAID;;AAGD,SAASE,YAAT,CAAsBC,CAAtB,EAAyB;AACvB,SAAO,CAACA,CAAC,IAAI,EAAN,EAAUC,OAAV,CAAkB,eAAlB,EAAmC,EAAnC,CAAP;AACD,C,CAGD;;;AACO,SAASC,QAAT,
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["model","session","env","Promise","resolve","modelResult","role","markupToText","s","replace","validate","config","points","excludeZero","errors","pointsDescriptorsErrors","forEach","point","index","identicalPointDescr","slice","some","p","Object","keys","length"],"mappings":";;;;;;;;AAAO,SAASA,KAAT,CAAeA,KAAf,EAAsBC,OAAtB,EAA+BC,GAA/B,EAAoC;AACzC,SAAO,IAAIC,OAAJ,CAAY,UAACC,OAAD,EAAa;AAC9B,QAAMC,WAAW,GAAG,CAACL,KAAD,GAAS,EAAT,GAAcA,KAAlC;AACAI,IAAAA,OAAO,CAACF,GAAG,IAAIA,GAAG,CAACI,IAAX,IAAmBJ,GAAG,CAACI,IAAJ,KAAa,YAAhC,GAA+CD,WAA/C,GAA6D,EAA9D,CAAP;AACD,GAHM,CAAP;AAID;;AAGD,SAASE,YAAT,CAAsBC,CAAtB,EAAyB;AACvB,SAAO,CAACA,CAAC,IAAI,EAAN,EAAUC,OAAV,CAAkB,eAAlB,EAAmC,EAAnC,CAAP;AACD,C,CAGD;;;AACO,SAASC,QAAT,CAAkBV,KAAlB,EAAyBW,MAAzB,EAAiC;AACtC,MAAQC,MAAR,GAAgCZ,KAAhC,CAAQY,MAAR;AAAA,MAAgBC,WAAhB,GAAgCb,KAAhC,CAAgBa,WAAhB;AACA,MAAMC,MAAM,GAAG,EAAf;AACA,MAAMC,uBAAuB,GAAG,EAAhC;AAEA,GAACH,MAAM,IAAI,EAAX,EAAeI,OAAf,CAAuB,UAACC,KAAD,EAAQC,KAAR,EAAkB;AACvC,QAAIA,KAAK,KAAK,CAAV,IAAeL,WAAnB,EAAgC;AAC9B;AACA;AACD;;AAED,QAAI,CAACI,KAAD,IAAUA,KAAK,KAAK,aAAxB,EAAuC;AACrCF,MAAAA,uBAAuB,CAACG,KAAD,CAAvB,GAAiC,qCAAjC;AACD,KAFD,MAEO;AACL,UAAMC,mBAAmB,GAAGP,MAAM,CAACQ,KAAP,CAAaF,KAAK,GAAG,CAArB,EAAwBG,IAAxB,CAA6B,UAAAC,CAAC;AAAA,eAAIf,YAAY,CAACe,CAAD,CAAZ,KAAoBf,YAAY,CAACU,KAAD,CAApC;AAAA,OAA9B,CAA5B;;AAEA,UAAIE,mBAAJ,EAAyB;AACvBJ,QAAAA,uBAAuB,CAACG,KAAD,CAAvB,GAAiC,sCAAjC;AACD;AACF;AACF,GAfD;;AAiBA,MAAIK,MAAM,CAACC,IAAP,CAAYT,uBAAZ,EAAqCU,MAArC,GAA8C,CAAlD,EAAqD;AACnDX,IAAAA,MAAM,CAACC,uBAAP,GAAiCA,uBAAjC;AACD;;AAED,SAAOD,MAAP;AACD","sourcesContent":["export function model(model, session, env) {\n return new Promise((resolve) => {\n const modelResult = !model ? {} : model;\n resolve(env && env.role && env.role === 'instructor' ? modelResult : {});\n });\n}\n\n\nfunction markupToText(s) {\n return (s || '').replace(/(<([^>]+)>)/ig, '');\n}\n\n\n// IMPORTANT! If you make any changes to this function, please make sure you also update complex-rubric/controller/validateSimpleRubric function!“.\nexport function validate(model, config) {\n const { points, excludeZero } = model;\n const errors = {};\n const pointsDescriptorsErrors = {};\n\n (points || []).forEach((point, index) => {\n if (index === 0 && excludeZero) {\n // if excludeZero is true, the 0 point is not displayed, so it should not be validated\n return;\n }\n\n if (!point || point === '<div></div>') {\n pointsDescriptorsErrors[index] = 'Points descriptors cannot be empty.';\n } else {\n const identicalPointDescr = points.slice(index + 1).some(p => markupToText(p) === markupToText(point));\n\n if (identicalPointDescr) {\n pointsDescriptorsErrors[index] = 'Points descriptors should be unique.';\n }\n }\n });\n\n if (Object.keys(pointsDescriptorsErrors).length > 0) {\n errors.pointsDescriptorsErrors = pointsDescriptorsErrors;\n }\n\n return errors;\n}\n"],"file":"index.js"}
|
package/controller/src/index.js
CHANGED
|
@@ -12,16 +12,20 @@ function markupToText(s) {
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
// IMPORTANT! If you make any changes to this function, please make sure you also update complex-rubric/controller/validateSimpleRubric function!“.
|
|
15
|
-
export function validate
|
|
16
|
-
const { points } = model;
|
|
15
|
+
export function validate(model, config) {
|
|
16
|
+
const { points, excludeZero } = model;
|
|
17
17
|
const errors = {};
|
|
18
18
|
const pointsDescriptorsErrors = {};
|
|
19
19
|
|
|
20
20
|
(points || []).forEach((point, index) => {
|
|
21
|
-
if(
|
|
22
|
-
|
|
21
|
+
if (index === 0 && excludeZero) {
|
|
22
|
+
// if excludeZero is true, the 0 point is not displayed, so it should not be validated
|
|
23
|
+
return;
|
|
23
24
|
}
|
|
24
|
-
|
|
25
|
+
|
|
26
|
+
if (!point || point === '<div></div>') {
|
|
27
|
+
pointsDescriptorsErrors[index] = 'Points descriptors cannot be empty.';
|
|
28
|
+
} else {
|
|
25
29
|
const identicalPointDescr = points.slice(index + 1).some(p => markupToText(p) === markupToText(point));
|
|
26
30
|
|
|
27
31
|
if (identicalPointDescr) {
|
|
@@ -30,7 +34,7 @@ export function validate (model, config) {
|
|
|
30
34
|
}
|
|
31
35
|
});
|
|
32
36
|
|
|
33
|
-
if(Object.keys(pointsDescriptorsErrors).length > 0){
|
|
37
|
+
if (Object.keys(pointsDescriptorsErrors).length > 0) {
|
|
34
38
|
errors.pointsDescriptorsErrors = pointsDescriptorsErrors;
|
|
35
39
|
}
|
|
36
40
|
|
package/docs/demo/generate.js
CHANGED
package/module/configure.js
CHANGED
|
@@ -230203,7 +230203,7 @@ var defaults = {};
|
|
|
230203
230203
|
model: {
|
|
230204
230204
|
points: ['', '', '', ''],
|
|
230205
230205
|
sampleAnswers: [null, null, null, null],
|
|
230206
|
-
maxPoints:
|
|
230206
|
+
maxPoints: 3,
|
|
230207
230207
|
excludeZero: false,
|
|
230208
230208
|
excludeZeroEnabled: true,
|
|
230209
230209
|
maxPointsEnabled: true
|
package/module/controller.js
CHANGED
|
@@ -19,10 +19,16 @@ function markupToText(s) {
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
function validate(model, config) {
|
|
22
|
-
var points = model.points
|
|
22
|
+
var points = model.points,
|
|
23
|
+
excludeZero = model.excludeZero;
|
|
23
24
|
var errors = {};
|
|
24
25
|
var pointsDescriptorsErrors = {};
|
|
25
26
|
(points || []).forEach(function (point, index) {
|
|
27
|
+
if (index === 0 && excludeZero) {
|
|
28
|
+
// if excludeZero is true, the 0 point is not displayed, so it should not be validated
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
26
32
|
if (!point || point === '<div></div>') {
|
|
27
33
|
pointsDescriptorsErrors[index] = 'Points descriptors cannot be empty.';
|
|
28
34
|
} else {
|
package/module/demo.js
CHANGED
package/module/print-demo.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/rubric",
|
|
3
|
-
"version": "3.1.8-next.
|
|
3
|
+
"version": "3.1.8-next.7+ef6ab1c42",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"module": "src/index.js",
|
|
6
6
|
"description": "Rubric Scoring Interaction",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"author": "pie framework developers",
|
|
17
17
|
"license": "ISC",
|
|
18
|
-
"gitHead": "
|
|
18
|
+
"gitHead": "ef6ab1c42d2d9ca9ccaccd30c179dea25981f58c",
|
|
19
19
|
"scripts": {
|
|
20
20
|
"postpublish": "../../scripts/postpublish"
|
|
21
21
|
},
|