@pie-element/complex-rubric 3.4.4 → 3.4.5-next.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/controller/lib/index.js +1 -7
- package/controller/lib/index.js.map +1 -1
- package/controller/src/index.js +1 -5
- package/module/configure.js +1 -1
- package/module/controller.js +1 -5
- package/module/element.js +1 -1
- package/module/index.html +1 -1
- package/module/manifest.json +2 -2
- package/module/print.html +1 -1
- package/module/print.js +1 -1
- package/package.json +4 -4
package/controller/lib/index.js
CHANGED
|
@@ -159,16 +159,10 @@ var createCorrectResponseSession = function createCorrectResponseSession(questio
|
|
|
159
159
|
exports.createCorrectResponseSession = createCorrectResponseSession;
|
|
160
160
|
|
|
161
161
|
var validateSimpleRubric = function validateSimpleRubric(model) {
|
|
162
|
-
var points = model.points
|
|
163
|
-
excludeZero = model.excludeZero;
|
|
162
|
+
var points = model.points;
|
|
164
163
|
var errors = {};
|
|
165
164
|
var pointsDescriptorsErrors = {};
|
|
166
165
|
(points || []).forEach(function (point, index) {
|
|
167
|
-
if (index === 0 && excludeZero) {
|
|
168
|
-
// if excludeZero is true, the 0 point is not displayed, so it should not be validated
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
166
|
if (!point || point === '<div></div>') {
|
|
173
167
|
pointsDescriptorsErrors[index] = 'Points descriptors cannot be empty.';
|
|
174
168
|
} else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["RUBRIC_TYPES","SIMPLE_RUBRIC","MULTI_TRAIT_RUBRIC","createDefaultModel","model","Promise","resolve","defaults","normalize","question","session","env","normalizedQuestion","rubricType","RUBRICLESS","role","rubrics","multiTraitRubric","visible","visibleToStudent","scales","excludeZero","parsedScales","map","scale","simpleRubric","rubricless","getScore","outcome","score","empty","createCorrectResponseSession","mode","id","validateSimpleRubric","points","errors","pointsDescriptorsErrors","forEach","point","index","identicalPointDescr","slice","some","p","Object","keys","length","validateMultiTraitRubric","description","pointLabels","traitsErrors","scorePointsErrors","scaleIndex","traits","scorePointsLabels","scaleErrors","scorePointsLabelsErrors","scorePointLabel","scoreIndex","identicalScorePointLabel","s","trait","traitIndex","name","identicalTraitName","t","identicalTraitDescr","validate","config"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;;;;;AAGA;AACA;AACA,IAAMA,YAAY,GAAG;AACnBC,EAAAA,aAAa,EAAE,cADI;AAEnBC,EAAAA,kBAAkB,EAAE,kBAFD;AAGnB,gBAAc;AAHK,CAArB;;AAMO,SAASC,kBAAT,GAAwC;AAAA,MAAZC,KAAY,uEAAJ,EAAI;AAC7C,SAAO,IAAIC,OAAJ,CAAY,UAACC,OAAD;AAAA,WAAaA,OAAO,iCAAMC,oBAAN,GAAmBH,KAAnB,EAApB;AAAA,GAAZ,CAAP;AACD;;AAEM,IAAMI,SAAS,GAAG,SAAZA,SAAY,CAACC,QAAD;AAAA,yCAAoBF,oBAApB,GAAiCE,QAAjC;AAAA,CAAlB;AAEP;AACA;AACA;AACA;AACA;;;;;SACsBL,K;;;;;yFAAf,iBAAqBK,QAArB,EAA+BC,OAA/B,EAAwCC,GAAxC;AAAA;;AAAA;AAAA;AAAA;AAAA;AACCC,YAAAA,kBADD,GACsBJ,SAAS,CAACC,QAAD,CAD/B;;AAAA,kBAIHG,kBAAkB,CAACC,UAAnB,KAAkCb,YAAY,CAACC,aAA/C,IACAW,kBAAkB,CAACC,UAAnB,KAAkCb,YAAY,CAACc,UAL5C;AAAA;AAAA;AAAA;;AAAA,6CAOI,IAAIT,OAAJ,CAAY,UAACC,OAAD,EAAa;AAC9BA,cAAAA,OAAO,CACLK,GAAG,IAAIA,GAAG,CAACI,IAAX,IAAmBJ,GAAG,CAACI,IAAJ,KAAa,YAAhC,mCAESH,kBAFT;AAGMI,gBAAAA,OAAO,kCACFJ,kBAAkB,CAACI,OADjB;AAELC,kBAAAA,gBAAgB,kCACXL,kBAAkB,CAACI,OAA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AA,MAAQA,OAAR,+BAAkB,EAAlB;AAAA,MAAsBH,UAAtB,GAAqCT,KAArC,CAAsBS,UAAtB;AACA,8BAAqDG,OAArD,CAAQC,gBAAR;AAAA,MAAQA,gBAAR,sCAA2B,EAA3B;AAAA,8BAAqDD,OAArD,CAA+BS,YAA/B;AAAA,MAA+BA,YAA/B,sCAA8C,EAA9C;AACA,MAAIW,MAAM,GAAG,EAAb;;AAEA,UAAQvB,UAAR;AACE,SAAKb,YAAY,CAACC,aAAlB;AACA;AACEmC,MAAAA,MAAM,GAAGF,oBAAoB,CAACT,YAAD,CAA7B;AACA;;AACF,SAAKzB,YAAY,CAACE,kBAAlB;AACEkC,MAAAA,MAAM,GAAGY,wBAAwB,CAAC/B,gBAAD,CAAjC;AACA;AAPJ;;AAUA,SAAOmB,MAAP;AACD,CAhBM","sourcesContent":["import defaults from './defaults';\nimport { markupToText } from './utils';\n\n\n// todo the import from pie-lib/rubric WILL break pslb\n// so don't use it unless you also test \"yarn build\"\nconst RUBRIC_TYPES = {\n SIMPLE_RUBRIC: 'simpleRubric',\n MULTI_TRAIT_RUBRIC: 'multiTraitRubric',\n 'rubricless': 'rubricless',\n};\n\nexport function createDefaultModel(model = {}) {\n return new Promise((resolve) => resolve({ ...defaults, ...model }));\n}\n\nexport const normalize = (question) => ({ ...defaults, ...question });\n\n/**\n * @param {*} question\n * @param {*} session\n * @param {*} env\n */\nexport async function model(question, session, env) {\n const normalizedQuestion = normalize(question);\n\n if (\n normalizedQuestion.rubricType === RUBRIC_TYPES.SIMPLE_RUBRIC ||\n normalizedQuestion.rubricType === RUBRIC_TYPES.RUBRICLESS\n ) {\n return new Promise((resolve) => {\n resolve(\n env && env.role && env.role === 'instructor'\n ? {\n ...normalizedQuestion,\n rubrics: {\n ...normalizedQuestion.rubrics,\n multiTraitRubric: {\n ...normalizedQuestion.rubrics.multiTraitRubric,\n visible: false,\n },\n },\n }\n : {},\n );\n });\n } else {\n if (\n !env.role ||\n (env.role === 'student' && normalizedQuestion.rubrics && normalizedQuestion.rubrics.multiTraitRubric)\n ) {\n normalizedQuestion.rubrics.multiTraitRubric.visible = normalizedQuestion.visibleToStudent;\n } else {\n normalizedQuestion.rubrics.multiTraitRubric.visible = true;\n }\n\n // todo update pie-ui instead of parsing this here:\n const { scales, excludeZero } = normalizedQuestion.rubrics.multiTraitRubric || {};\n const parsedScales = (scales || []).map((scale) => ({ ...scale, excludeZero }));\n\n return {\n ...normalizedQuestion,\n rubrics: {\n ...normalizedQuestion.rubrics,\n simpleRubric: {\n ...normalizedQuestion.rubrics.simpleRubric,\n visible: false,\n },\n rubricless: {\n ...normalizedQuestion.rubrics.rubricless,\n visible: false,\n },\n multiTraitRubric: {\n ...normalizedQuestion.rubrics.multiTraitRubric,\n scales: parsedScales,\n },\n },\n };\n }\n}\n\nexport const getScore = () => 0;\n\n/**\n * @param {Object} model - the main model\n * @param {*} session\n * @param {Object} env\n */\nexport function outcome() {\n return new Promise((resolve) => resolve({ score: 0, empty: true }));\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n resolve({ id: '1' });\n } else {\n resolve(null);\n }\n });\n};\n\n// IMPORTANT! This function is a duplicate of rubric/controller/validate function!\n// If you make any changes to this function, please make sure you also update rubric/controller/validate function!“.\nconst validateSimpleRubric = (model) => {\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\n// IMPORTANT! This function is a duplicate of multi-trait-rubric/controller/validate function!\n// If you make any changes to this function, please make sure you also update multi-trait-rubric/controller/validate function!“.\nconst validateMultiTraitRubric = (model) => {\n const { scales, description = false, pointLabels = false } = model;\n const errors = {};\n const traitsErrors = {};\n const scorePointsErrors = {};\n\n (scales || []).forEach((scale, scaleIndex) => {\n const { traits = [] } = scale;\n const { scorePointsLabels = [] } = scale;\n const scaleErrors = {};\n const scorePointsLabelsErrors = {};\n\n if (pointLabels) {\n scorePointsLabels.forEach((scorePointLabel, scoreIndex) => {\n if (!scorePointLabel || scorePointLabel === '<div></div>') {\n scorePointsLabelsErrors[scoreIndex] = 'Points labels should not be empty.';\n } else {\n const identicalScorePointLabel = scorePointsLabels\n .slice(scoreIndex + 1)\n .some((s) => markupToText(s) === markupToText(scorePointLabel));\n\n if (identicalScorePointLabel) {\n scorePointsLabelsErrors[scoreIndex] = 'Points labels should be unique.';\n }\n }\n });\n }\n\n if (Object.keys(scorePointsLabelsErrors).length > 0) {\n scorePointsErrors[scaleIndex] = scorePointsLabelsErrors;\n }\n\n traits.forEach((trait, traitIndex) => {\n if (!trait.name || trait.name === '<div></div>') {\n scaleErrors[traitIndex] = { name: 'Trait names should not be empty.' };\n } else {\n const identicalTraitName = traits\n .slice(traitIndex + 1)\n .some((t) => markupToText(t.name) === markupToText(trait.name));\n\n if (identicalTraitName) {\n scaleErrors[traitIndex] = { name: 'Trait names should be unique.' };\n }\n }\n if (description && (!trait.description || trait.description === '<div></div>')) {\n scaleErrors[traitIndex] = { ...scaleErrors[traitIndex], description: 'Trait description should not be empty' };\n } else {\n const identicalTraitDescr = traits\n .slice(traitIndex + 1)\n .some((t) => markupToText(t.description) === markupToText(trait.description));\n\n if (description && identicalTraitDescr) {\n scaleErrors[traitIndex] = { ...scaleErrors[traitIndex], description: 'Trait descriptions should be unique.' };\n }\n }\n });\n if (Object.keys(scaleErrors).length > 0) {\n traitsErrors[scaleIndex] = scaleErrors;\n }\n });\n\n if (Object.keys(traitsErrors).length > 0) {\n errors.traitsErrors = traitsErrors;\n }\n\n if (Object.keys(scorePointsErrors).length > 0) {\n errors.scorePointsErrors = scorePointsErrors;\n }\n\n return errors;\n};\n\nexport const validate = (model = {}, config = {}) => {\n const { rubrics = {}, rubricType } = model;\n const { multiTraitRubric = {}, simpleRubric = {} } = rubrics;\n let errors = {};\n\n switch (rubricType) {\n case RUBRIC_TYPES.SIMPLE_RUBRIC:\n default:\n errors = validateSimpleRubric(simpleRubric);\n break;\n case RUBRIC_TYPES.MULTI_TRAIT_RUBRIC:\n errors = validateMultiTraitRubric(multiTraitRubric);\n break;\n }\n\n return errors;\n};\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["RUBRIC_TYPES","SIMPLE_RUBRIC","MULTI_TRAIT_RUBRIC","createDefaultModel","model","Promise","resolve","defaults","normalize","question","session","env","normalizedQuestion","rubricType","RUBRICLESS","role","rubrics","multiTraitRubric","visible","visibleToStudent","scales","excludeZero","parsedScales","map","scale","simpleRubric","rubricless","getScore","outcome","score","empty","createCorrectResponseSession","mode","id","validateSimpleRubric","points","errors","pointsDescriptorsErrors","forEach","point","index","identicalPointDescr","slice","some","p","Object","keys","length","validateMultiTraitRubric","description","pointLabels","traitsErrors","scorePointsErrors","scaleIndex","traits","scorePointsLabels","scaleErrors","scorePointsLabelsErrors","scorePointLabel","scoreIndex","identicalScorePointLabel","s","trait","traitIndex","name","identicalTraitName","t","identicalTraitDescr","validate","config"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;;;;;AAGA;AACA;AACA,IAAMA,YAAY,GAAG;AACnBC,EAAAA,aAAa,EAAE,cADI;AAEnBC,EAAAA,kBAAkB,EAAE,kBAFD;AAGnB,gBAAc;AAHK,CAArB;;AAMO,SAASC,kBAAT,GAAwC;AAAA,MAAZC,KAAY,uEAAJ,EAAI;AAC7C,SAAO,IAAIC,OAAJ,CAAY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AArE;AACD;AACF;AACF,KAvBD;;AAwBA,QAAIJ,MAAM,CAACC,IAAP,CAAYU,WAAZ,EAAyBT,MAAzB,GAAkC,CAAtC,EAAyC;AACvCI,MAAAA,YAAY,CAACE,UAAD,CAAZ,GAA2BG,WAA3B;AACD;AACF,GArDD;;AAuDA,MAAIX,MAAM,CAACC,IAAP,CAAYK,YAAZ,EAA0BJ,MAA1B,GAAmC,CAAvC,EAA0C;AACxCX,IAAAA,MAAM,CAACe,YAAP,GAAsBA,YAAtB;AACD;;AAED,MAAIN,MAAM,CAACC,IAAP,CAAYM,iBAAZ,EAA+BL,MAA/B,GAAwC,CAA5C,EAA+C;AAC7CX,IAAAA,MAAM,CAACgB,iBAAP,GAA2BA,iBAA3B;AACD;;AAED,SAAOhB,MAAP;AACD,CAtED;;AAwEO,IAAMgC,QAAQ,GAAG,SAAXA,QAAW,GAA6B;AAAA,MAA5BhE,KAA4B,uEAApB,EAAoB;AAAA,MAAhBiE,MAAgB,uEAAP,EAAO;AACnD,uBAAqCjE,KAArC,CAAQY,OAAR;AAAA,MAAQA,OAAR,+BAAkB,EAAlB;AAAA,MAAsBH,UAAtB,GAAqCT,KAArC,CAAsBS,UAAtB;AACA,8BAAqDG,OAArD,CAAQC,gBAAR;AAAA,MAAQA,gBAAR,sCAA2B,EAA3B;AAAA,8BAAqDD,OAArD,CAA+BS,YAA/B;AAAA,MAA+BA,YAA/B,sCAA8C,EAA9C;AACA,MAAIW,MAAM,GAAG,EAAb;;AAEA,UAAQvB,UAAR;AACE,SAAKb,YAAY,CAACC,aAAlB;AACA;AACEmC,MAAAA,MAAM,GAAGF,oBAAoB,CAACT,YAAD,CAA7B;AACA;;AACF,SAAKzB,YAAY,CAACE,kBAAlB;AACEkC,MAAAA,MAAM,GAAGY,wBAAwB,CAAC/B,gBAAD,CAAjC;AACA;AAPJ;;AAUA,SAAOmB,MAAP;AACD,CAhBM","sourcesContent":["import defaults from './defaults';\nimport { markupToText } from './utils';\n\n\n// todo the import from pie-lib/rubric WILL break pslb\n// so don't use it unless you also test \"yarn build\"\nconst RUBRIC_TYPES = {\n SIMPLE_RUBRIC: 'simpleRubric',\n MULTI_TRAIT_RUBRIC: 'multiTraitRubric',\n 'rubricless': 'rubricless',\n};\n\nexport function createDefaultModel(model = {}) {\n return new Promise((resolve) => resolve({ ...defaults, ...model }));\n}\n\nexport const normalize = (question) => ({ ...defaults, ...question });\n\n/**\n * @param {*} question\n * @param {*} session\n * @param {*} env\n */\nexport async function model(question, session, env) {\n const normalizedQuestion = normalize(question);\n\n if (\n normalizedQuestion.rubricType === RUBRIC_TYPES.SIMPLE_RUBRIC ||\n normalizedQuestion.rubricType === RUBRIC_TYPES.RUBRICLESS\n ) {\n return new Promise((resolve) => {\n resolve(\n env && env.role && env.role === 'instructor'\n ? {\n ...normalizedQuestion,\n rubrics: {\n ...normalizedQuestion.rubrics,\n multiTraitRubric: {\n ...normalizedQuestion.rubrics.multiTraitRubric,\n visible: false,\n },\n },\n }\n : {},\n );\n });\n } else {\n if (\n !env.role ||\n (env.role === 'student' && normalizedQuestion.rubrics && normalizedQuestion.rubrics.multiTraitRubric)\n ) {\n normalizedQuestion.rubrics.multiTraitRubric.visible = normalizedQuestion.visibleToStudent;\n } else {\n normalizedQuestion.rubrics.multiTraitRubric.visible = true;\n }\n\n // todo update pie-ui instead of parsing this here:\n const { scales, excludeZero } = normalizedQuestion.rubrics.multiTraitRubric || {};\n const parsedScales = (scales || []).map((scale) => ({ ...scale, excludeZero }));\n\n return {\n ...normalizedQuestion,\n rubrics: {\n ...normalizedQuestion.rubrics,\n simpleRubric: {\n ...normalizedQuestion.rubrics.simpleRubric,\n visible: false,\n },\n rubricless: {\n ...normalizedQuestion.rubrics.rubricless,\n visible: false,\n },\n multiTraitRubric: {\n ...normalizedQuestion.rubrics.multiTraitRubric,\n scales: parsedScales,\n },\n },\n };\n }\n}\n\nexport const getScore = () => 0;\n\n/**\n * @param {Object} model - the main model\n * @param {*} session\n * @param {Object} env\n */\nexport function outcome() {\n return new Promise((resolve) => resolve({ score: 0, empty: true }));\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n resolve({ id: '1' });\n } else {\n resolve(null);\n }\n });\n};\n\n// IMPORTANT! This function is a duplicate of rubric/controller/validate function!\n// If you make any changes to this function, please make sure you also update rubric/controller/validate function!“.\nconst validateSimpleRubric = (model) => {\n const { points } = model;\n const errors = {};\n const pointsDescriptorsErrors = {};\n\n (points || []).forEach((point, index) => {\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\n// IMPORTANT! This function is a duplicate of multi-trait-rubric/controller/validate function!\n// If you make any changes to this function, please make sure you also update multi-trait-rubric/controller/validate function!“.\nconst validateMultiTraitRubric = (model) => {\n const { scales, description = false, pointLabels = false } = model;\n const errors = {};\n const traitsErrors = {};\n const scorePointsErrors = {};\n\n (scales || []).forEach((scale, scaleIndex) => {\n const { traits = [] } = scale;\n const { scorePointsLabels = [] } = scale;\n const scaleErrors = {};\n const scorePointsLabelsErrors = {};\n\n if (pointLabels) {\n scorePointsLabels.forEach((scorePointLabel, scoreIndex) => {\n if (!scorePointLabel || scorePointLabel === '<div></div>') {\n scorePointsLabelsErrors[scoreIndex] = 'Points labels should not be empty.';\n } else {\n const identicalScorePointLabel = scorePointsLabels\n .slice(scoreIndex + 1)\n .some((s) => markupToText(s) === markupToText(scorePointLabel));\n\n if (identicalScorePointLabel) {\n scorePointsLabelsErrors[scoreIndex] = 'Points labels should be unique.';\n }\n }\n });\n }\n\n if (Object.keys(scorePointsLabelsErrors).length > 0) {\n scorePointsErrors[scaleIndex] = scorePointsLabelsErrors;\n }\n\n traits.forEach((trait, traitIndex) => {\n if (!trait.name || trait.name === '<div></div>') {\n scaleErrors[traitIndex] = { name: 'Trait names should not be empty.' };\n } else {\n const identicalTraitName = traits\n .slice(traitIndex + 1)\n .some((t) => markupToText(t.name) === markupToText(trait.name));\n\n if (identicalTraitName) {\n scaleErrors[traitIndex] = { name: 'Trait names should be unique.' };\n }\n }\n if (description && (!trait.description || trait.description === '<div></div>')) {\n scaleErrors[traitIndex] = { ...scaleErrors[traitIndex], description: 'Trait description should not be empty' };\n } else {\n const identicalTraitDescr = traits\n .slice(traitIndex + 1)\n .some((t) => markupToText(t.description) === markupToText(trait.description));\n\n if (description && identicalTraitDescr) {\n scaleErrors[traitIndex] = { ...scaleErrors[traitIndex], description: 'Trait descriptions should be unique.' };\n }\n }\n });\n if (Object.keys(scaleErrors).length > 0) {\n traitsErrors[scaleIndex] = scaleErrors;\n }\n });\n\n if (Object.keys(traitsErrors).length > 0) {\n errors.traitsErrors = traitsErrors;\n }\n\n if (Object.keys(scorePointsErrors).length > 0) {\n errors.scorePointsErrors = scorePointsErrors;\n }\n\n return errors;\n};\n\nexport const validate = (model = {}, config = {}) => {\n const { rubrics = {}, rubricType } = model;\n const { multiTraitRubric = {}, simpleRubric = {} } = rubrics;\n let errors = {};\n\n switch (rubricType) {\n case RUBRIC_TYPES.SIMPLE_RUBRIC:\n default:\n errors = validateSimpleRubric(simpleRubric);\n break;\n case RUBRIC_TYPES.MULTI_TRAIT_RUBRIC:\n errors = validateMultiTraitRubric(multiTraitRubric);\n break;\n }\n\n return errors;\n};\n"],"file":"index.js"}
|
package/controller/src/index.js
CHANGED
|
@@ -103,15 +103,11 @@ export const createCorrectResponseSession = (question, env) => {
|
|
|
103
103
|
// IMPORTANT! This function is a duplicate of rubric/controller/validate function!
|
|
104
104
|
// If you make any changes to this function, please make sure you also update rubric/controller/validate function!“.
|
|
105
105
|
const validateSimpleRubric = (model) => {
|
|
106
|
-
const { points
|
|
106
|
+
const { points } = model;
|
|
107
107
|
const errors = {};
|
|
108
108
|
const pointsDescriptorsErrors = {};
|
|
109
109
|
|
|
110
110
|
(points || []).forEach((point, index) => {
|
|
111
|
-
if (index === 0 && excludeZero) {
|
|
112
|
-
// if excludeZero is true, the 0 point is not displayed, so it should not be validated
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
111
|
|
|
116
112
|
if (!point || point === '<div></div>') {
|
|
117
113
|
pointsDescriptorsErrors[index] = 'Points descriptors cannot be empty.';
|
package/module/configure.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.3.
|
|
1
|
+
import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.3.3/module/index.js";
|
|
2
2
|
import RubricConfigure from '@pie-element/rubric/configure/lib';
|
|
3
3
|
import {_dll_pie_lib__pie_toolbox_editable_html, _dll_pie_lib__pie_toolbox_render_ui, _dll_pie_lib__pie_toolbox_config_ui} from "../../../@pie-lib/pie-toolbox-module@5.10.2/module/index.js";
|
|
4
4
|
function _mergeNamespaces(n, m) {
|
package/module/controller.js
CHANGED
|
@@ -143,15 +143,11 @@ const createCorrectResponseSession = (question, env) => {
|
|
|
143
143
|
// IMPORTANT! This function is a duplicate of rubric/controller/validate function!
|
|
144
144
|
// If you make any changes to this function, please make sure you also update rubric/controller/validate function!“.
|
|
145
145
|
const validateSimpleRubric = (model) => {
|
|
146
|
-
const { points
|
|
146
|
+
const { points } = model;
|
|
147
147
|
const errors = {};
|
|
148
148
|
const pointsDescriptorsErrors = {};
|
|
149
149
|
|
|
150
150
|
(points || []).forEach((point, index) => {
|
|
151
|
-
if (index === 0 && excludeZero) {
|
|
152
|
-
// if excludeZero is true, the 0 point is not displayed, so it should not be validated
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
151
|
|
|
156
152
|
if (!point || point === '<div></div>') {
|
|
157
153
|
pointsDescriptorsErrors[index] = 'Points descriptors cannot be empty.';
|
package/module/element.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {_dll_react, _dll_prop_types, _dll_react_dom, _dll_classnames, _dll_debug, _dll_pie_lib__pie_toolbox_math_rendering, _dll_lodash, _dll_react_dom_server, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.3.
|
|
1
|
+
import {_dll_react, _dll_prop_types, _dll_react_dom, _dll_classnames, _dll_debug, _dll_pie_lib__pie_toolbox_math_rendering, _dll_lodash, _dll_react_dom_server, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.3.3/module/index.js";
|
|
2
2
|
import {_dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@5.10.2/module/index.js";
|
|
3
3
|
function _mergeNamespaces(n, m) {
|
|
4
4
|
m.forEach(function (e) {
|
package/module/index.html
CHANGED
package/module/manifest.json
CHANGED
package/module/print.html
CHANGED
package/module/print.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {_dll_react, _dll_prop_types, _dll_react_dom, _dll_classnames, _dll_debug, _dll_pie_lib__pie_toolbox_math_rendering, _dll_lodash, _dll_react_dom_server, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.3.
|
|
1
|
+
import {_dll_react, _dll_prop_types, _dll_react_dom, _dll_classnames, _dll_debug, _dll_pie_lib__pie_toolbox_math_rendering, _dll_lodash, _dll_react_dom_server, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.3.3/module/index.js";
|
|
2
2
|
import {_dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@5.10.2/module/index.js";
|
|
3
3
|
function _mergeNamespaces(n, m) {
|
|
4
4
|
m.forEach(function (e) {
|
package/package.json
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/complex-rubric",
|
|
3
3
|
"repository": "pie-framework/pie-elements",
|
|
4
|
-
"version": "3.4.
|
|
4
|
+
"version": "3.4.5-next.10+29cb392a6",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@material-ui/core": "^3.9.2",
|
|
10
|
-
"@pie-element/multi-trait-rubric": "^4.3.
|
|
11
|
-
"@pie-element/rubric": "^4.4.
|
|
10
|
+
"@pie-element/multi-trait-rubric": "^4.3.5-next.10+29cb392a6",
|
|
11
|
+
"@pie-element/rubric": "^4.4.5-next.10+29cb392a6",
|
|
12
12
|
"@pie-framework/pie-player-events": "^0.1.0",
|
|
13
13
|
"classnames": "^2.2.5",
|
|
14
14
|
"debug": "^4.1.1",
|
|
15
15
|
"lodash": "^4.17.11",
|
|
16
16
|
"prop-types": "^15.7.2"
|
|
17
17
|
},
|
|
18
|
-
"gitHead": "
|
|
18
|
+
"gitHead": "29cb392a6b20836b25a322f1ef94b8c4dc8eb245",
|
|
19
19
|
"scripts": {
|
|
20
20
|
"postpublish": "../../scripts/postpublish"
|
|
21
21
|
},
|