@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.
@@ -8,7 +8,7 @@ var _default = {
8
8
  model: {
9
9
  points: ['', '', '', ''],
10
10
  sampleAnswers: [null, null, null, null],
11
- maxPoints: 4,
11
+ maxPoints: 3,
12
12
  excludeZero: false,
13
13
  excludeZeroEnabled: true,
14
14
  maxPointsEnabled: true
@@ -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: 4,\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"}
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"}
@@ -2,7 +2,7 @@ export default {
2
2
  model: {
3
3
  points: ['', '', '', ''],
4
4
  sampleAnswers: [null, null, null, null],
5
- maxPoints: 4,
5
+ maxPoints: 3,
6
6
  excludeZero: false,
7
7
  excludeZeroEnabled: true,
8
8
  maxPointsEnabled: true,
@@ -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,CAAmBV,KAAnB,EAA0BW,MAA1B,EAAkC;AACvC,MAAQC,MAAR,GAAmBZ,KAAnB,CAAQY,MAAR;AACA,MAAMC,MAAM,GAAG,EAAf;AACA,MAAMC,uBAAuB,GAAG,EAAhC;AAEA,GAACF,MAAM,IAAI,EAAX,EAAeG,OAAf,CAAuB,UAACC,KAAD,EAAQC,KAAR,EAAkB;AACvC,QAAG,CAACD,KAAD,IAASA,KAAK,KAAK,aAAtB,EAAqC;AACnCF,MAAAA,uBAAuB,CAACG,KAAD,CAAvB,GAAiC,qCAAjC;AACD,KAFD,MAGI;AACF,UAAMC,mBAAmB,GAAGN,MAAM,CAACO,KAAP,CAAaF,KAAK,GAAG,CAArB,EAAwBG,IAAxB,CAA6B,UAAAC,CAAC;AAAA,eAAId,YAAY,CAACc,CAAD,CAAZ,KAAoBd,YAAY,CAACS,KAAD,CAApC;AAAA,OAA9B,CAA5B;;AAEA,UAAIE,mBAAJ,EAAyB;AACvBJ,QAAAA,uBAAuB,CAACG,KAAD,CAAvB,GAAiC,sCAAjC;AACD;AACF;AACF,GAXD;;AAaA,MAAGK,MAAM,CAACC,IAAP,CAAYT,uBAAZ,EAAqCU,MAArC,GAA8C,CAAjD,EAAmD;AACjDX,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 } = model;\n const errors = {};\n const pointsDescriptorsErrors = {};\n\n (points || []).forEach((point, index) => {\n if(!point|| point === '<div></div>') {\n pointsDescriptorsErrors[index] = 'Points descriptors cannot be empty.';\n }\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"}
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"}
@@ -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 (model, config) {
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(!point|| point === '<div></div>') {
22
- pointsDescriptorsErrors[index] = 'Points descriptors cannot be empty.';
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
- else{
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
 
@@ -3,6 +3,6 @@ exports.model = (id, element) => ({
3
3
  element,
4
4
  points: ['nothing right', 'a teeny bit right', 'mostly right', 'bingo'],
5
5
  sampleAnswers: [null, 'just right', 'not left', null],
6
- maxPoints: 4,
6
+ maxPoints: 3,
7
7
  excludeZero: false,
8
8
  });
@@ -230203,7 +230203,7 @@ var defaults = {};
230203
230203
  model: {
230204
230204
  points: ['', '', '', ''],
230205
230205
  sampleAnswers: [null, null, null, null],
230206
- maxPoints: 4,
230206
+ maxPoints: 3,
230207
230207
  excludeZero: false,
230208
230208
  excludeZeroEnabled: true,
230209
230209
  maxPointsEnabled: true
@@ -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
@@ -9,7 +9,7 @@ generate.model = (id, element) => ({
9
9
  element,
10
10
  points: ['nothing right', 'a teeny bit right', 'mostly right', 'bingo'],
11
11
  sampleAnswers: [null, 'just right', 'not left', null],
12
- maxPoints: 4,
12
+ maxPoints: 3,
13
13
  excludeZero: false,
14
14
  });
15
15
 
@@ -7,7 +7,7 @@ generate.model = (id, element) => ({
7
7
  element,
8
8
  points: ['nothing right', 'a teeny bit right', 'mostly right', 'bingo'],
9
9
  sampleAnswers: [null, 'just right', 'not left', null],
10
- maxPoints: 4,
10
+ maxPoints: 3,
11
11
  excludeZero: false,
12
12
  });
13
13
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-element/rubric",
3
- "version": "3.1.8-next.0+69422f10e",
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": "69422f10e6790930605ab592d2b1e97353df4ada",
18
+ "gitHead": "ef6ab1c42d2d9ca9ccaccd30c179dea25981f58c",
19
19
  "scripts": {
20
20
  "postpublish": "../../scripts/postpublish"
21
21
  },