@pie-element/complex-rubric 1.11.2 → 1.11.3
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/module/configure.js +29420 -0
- package/module/controller.js +221 -0
- package/module/demo.js +216 -0
- package/module/element.js +29971 -0
- package/module/index.html +21 -0
- package/module/manifest.json +14 -0
- package/module/print-demo.js +254 -0
- package/module/print.html +18 -0
- package/module/print.js +29972 -0
- package/package.json +2 -2
- package/LICENSE.md +0 -5
- package/configure/lib/defaults.js +0 -108
- package/configure/lib/defaults.js.map +0 -1
- package/configure/lib/index.js +0 -234
- package/configure/lib/index.js.map +0 -1
- package/configure/lib/main.js +0 -180
- package/configure/lib/main.js.map +0 -1
- package/controller/lib/defaults.js +0 -107
- package/controller/lib/defaults.js.map +0 -1
- package/controller/lib/index.js +0 -150
- package/controller/lib/index.js.map +0 -1
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
var multiTraitDefaultModel = {
|
|
8
|
-
visibleToStudent: true,
|
|
9
|
-
halfScoring: false,
|
|
10
|
-
pointLabels: true,
|
|
11
|
-
description: false,
|
|
12
|
-
standards: false,
|
|
13
|
-
scales: [],
|
|
14
|
-
excludeZero: false
|
|
15
|
-
};
|
|
16
|
-
var rubricDefaultModel = {
|
|
17
|
-
points: ['', '', '', ''],
|
|
18
|
-
sampleAnswers: [null, null, null, null],
|
|
19
|
-
maxPoints: 4,
|
|
20
|
-
excludeZero: false
|
|
21
|
-
};
|
|
22
|
-
var multiTraitDefaultConfiguration = {
|
|
23
|
-
settingsPanelDisabled: false,
|
|
24
|
-
excludeZeroDialogBoxContent: {
|
|
25
|
-
title: 'Exclude 0 (Zero) from Score Point Values.',
|
|
26
|
-
text: "<div>\n You are about to exclude 0 from score point values.\n <br/>\n Some of the existing data has to be changed.\n <br/>\n Please choose if you want to:\n <ul>\n <li>\n shift Labels and Descriptions to the left\n </li>\n <li>\n remove 0 column with its Label and Description\n </li>\n </ul>\n </div>"
|
|
27
|
-
},
|
|
28
|
-
includeZeroDialogBoxContent: {
|
|
29
|
-
title: 'Include 0 (Zero) in Score Point Values.',
|
|
30
|
-
text: "<div>\n You are about to include 0 in score point values.\n <br/>\n Some of the existing data has to be changed.\n <br/>\n Please choose if you want to:\n <ul>\n <li>\n shift Labels and Descriptions to the right\n </li>\n <li>\n add 0 column with empty Label and Descriptions\n </li>\n </ul>\n </div>"
|
|
31
|
-
},
|
|
32
|
-
deleteScaleDialogBoxContent: {
|
|
33
|
-
title: 'Delete Scale',
|
|
34
|
-
text: 'Are you sure you want to delete this scale?'
|
|
35
|
-
},
|
|
36
|
-
maxPointsDialogBoxContent: {
|
|
37
|
-
title: 'Decreasing Max Points.',
|
|
38
|
-
text: " You are about to decrease max score point value.\n <br/>\n All the Labels and Descriptions for scores above Max Point will be deleted."
|
|
39
|
-
},
|
|
40
|
-
spellCheck: {
|
|
41
|
-
label: 'Spellcheck',
|
|
42
|
-
settings: false,
|
|
43
|
-
enabled: true
|
|
44
|
-
},
|
|
45
|
-
showExcludeZero: {
|
|
46
|
-
settings: true,
|
|
47
|
-
label: 'Exclude Zero'
|
|
48
|
-
},
|
|
49
|
-
showScorePointLabels: {
|
|
50
|
-
settings: true,
|
|
51
|
-
label: 'Show Score Point Labels'
|
|
52
|
-
},
|
|
53
|
-
showDescription: {
|
|
54
|
-
settings: true,
|
|
55
|
-
label: 'Show Description'
|
|
56
|
-
},
|
|
57
|
-
showVisibleToStudent: {
|
|
58
|
-
settings: true,
|
|
59
|
-
label: 'Visible to Student'
|
|
60
|
-
},
|
|
61
|
-
showHalfScoring: {
|
|
62
|
-
settings: true,
|
|
63
|
-
label: 'Half Scoring'
|
|
64
|
-
},
|
|
65
|
-
width: '900px',
|
|
66
|
-
// these should not be set to true (should not be used) for now
|
|
67
|
-
showStandards: {
|
|
68
|
-
settings: false,
|
|
69
|
-
label: 'Show Standards'
|
|
70
|
-
},
|
|
71
|
-
showLevelTagInput: {
|
|
72
|
-
settings: false,
|
|
73
|
-
label: 'Show Level Tag Input',
|
|
74
|
-
enabled: false
|
|
75
|
-
},
|
|
76
|
-
dragAndDrop: {
|
|
77
|
-
settings: true,
|
|
78
|
-
label: 'Enable Drag and Drop',
|
|
79
|
-
enabled: false
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
var rubricDefaultConfiguration = {
|
|
83
|
-
showExcludeZero: {
|
|
84
|
-
settings: true,
|
|
85
|
-
label: 'Ability to exclude zero'
|
|
86
|
-
},
|
|
87
|
-
showMaxPoint: {
|
|
88
|
-
settings: true,
|
|
89
|
-
label: 'Show max points dropdown'
|
|
90
|
-
},
|
|
91
|
-
settingsPanelDisabled: false
|
|
92
|
-
};
|
|
93
|
-
var _default = {
|
|
94
|
-
model: {
|
|
95
|
-
rubricType: 'simpleRubric',
|
|
96
|
-
rubrics: {
|
|
97
|
-
simpleRubric: rubricDefaultModel,
|
|
98
|
-
multiTraitRubric: multiTraitDefaultModel
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
configuration: {
|
|
102
|
-
multiTraitRubric: multiTraitDefaultConfiguration,
|
|
103
|
-
simpleRubric: rubricDefaultConfiguration
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
exports["default"] = _default;
|
|
107
|
-
//# sourceMappingURL=defaults.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/defaults.js"],"names":["multiTraitDefaultModel","visibleToStudent","halfScoring","pointLabels","description","standards","scales","excludeZero","rubricDefaultModel","points","sampleAnswers","maxPoints","multiTraitDefaultConfiguration","settingsPanelDisabled","excludeZeroDialogBoxContent","title","text","includeZeroDialogBoxContent","deleteScaleDialogBoxContent","maxPointsDialogBoxContent","spellCheck","label","settings","enabled","showExcludeZero","showScorePointLabels","showDescription","showVisibleToStudent","showHalfScoring","width","showStandards","showLevelTagInput","dragAndDrop","rubricDefaultConfiguration","showMaxPoint","model","rubricType","rubrics","simpleRubric","multiTraitRubric","configuration"],"mappings":";;;;;;AAAA,IAAMA,sBAAsB,GAAG;AAC7BC,EAAAA,gBAAgB,EAAE,IADW;AAE7BC,EAAAA,WAAW,EAAE,KAFgB;AAG7BC,EAAAA,WAAW,EAAE,IAHgB;AAI7BC,EAAAA,WAAW,EAAE,KAJgB;AAK7BC,EAAAA,SAAS,EAAE,KALkB;AAM7BC,EAAAA,MAAM,EAAE,EANqB;AAO7BC,EAAAA,WAAW,EAAE;AAPgB,CAA/B;AAUA,IAAMC,kBAAkB,GAAG;AACzBC,EAAAA,MAAM,EAAE,CAAC,EAAD,EAAK,EAAL,EAAS,EAAT,EAAa,EAAb,CADiB;AAEzBC,EAAAA,aAAa,EAAE,CAAC,IAAD,EAAO,IAAP,EAAa,IAAb,EAAmB,IAAnB,CAFU;AAGzBC,EAAAA,SAAS,EAAE,CAHc;AAIzBJ,EAAAA,WAAW,EAAE;AAJY,CAA3B;AAOA,IAAMK,8BAA8B,GAAG;AACrCC,EAAAA,qBAAqB,EAAE,KADc;AAErCC,EAAAA,2BAA2B,EAAE;AAC3BC,IAAAA,KAAK,EAAE,2CADoB;AAE3BC,IAAAA,IAAI;AAFuB,GAFQ;AAoBrCC,EAAAA,2BAA2B,EAAE;AAC3BF,IAAAA,KAAK,EAAE,yCADoB;AAE3BC,IAAAA,IAAI;AAFuB,GApBQ;AAsCrCE,EAAAA,2BAA2B,EAAE;AAC3BH,IAAAA,KAAK,EAAE,cADoB;AAE3BC,IAAAA,IAAI,EAAE;AAFqB,GAtCQ;AA0CrCG,EAAAA,yBAAyB,EAAE;AACzBJ,IAAAA,KAAK,EAAE,wBADkB;AAEzBC,IAAAA,IAAI;AAFqB,GA1CU;AAgDrCI,EAAAA,UAAU,EAAE;AACVC,IAAAA,KAAK,EAAE,YADG;AAEVC,IAAAA,QAAQ,EAAE,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,EAAE;AATU,CAAnC;eAYe;AACbsB,EAAAA,KAAK,EAAE;AACLC,IAAAA,UAAU,EAAE,cADP;AAELC,IAAAA,OAAO,EAAE;AAAEC,MAAAA,YAAY,EAAE9B,kBAAhB;AAAoC+B,MAAAA,gBAAgB,EAAEvC;AAAtD;AAFJ,GADM;AAKbwC,EAAAA,aAAa,EAAE;AACbD,IAAAA,gBAAgB,EAAE3B,8BADL;AAEb0B,IAAAA,YAAY,EAAEL;AAFD;AALF,C","sourcesContent":["const multiTraitDefaultModel = {\n visibleToStudent: true,\n halfScoring: false,\n pointLabels: true,\n description: false,\n standards: false,\n scales: [],\n excludeZero: false,\n};\n\nconst rubricDefaultModel = {\n points: ['', '', '', ''],\n sampleAnswers: [null, null, null, null],\n maxPoints: 4,\n excludeZero: false,\n};\n\nconst multiTraitDefaultConfiguration = {\n settingsPanelDisabled: false,\n excludeZeroDialogBoxContent: {\n title: 'Exclude 0 (Zero) from Score Point Values.',\n text: `<div>\n You are about to exclude 0 from score point values.\n <br/>\n Some of the existing data has to be changed.\n <br/>\n Please choose if you want to:\n <ul>\n <li>\n shift Labels and Descriptions to the left\n </li>\n <li>\n remove 0 column with its Label and Description\n </li>\n </ul>\n </div>`,\n },\n includeZeroDialogBoxContent: {\n title: 'Include 0 (Zero) in Score Point Values.',\n text: `<div>\n You are about to include 0 in score point values.\n <br/>\n Some of the existing data has to be changed.\n <br/>\n Please choose if you want to:\n <ul>\n <li>\n shift Labels and Descriptions to the right\n </li>\n <li>\n add 0 column with empty Label and Descriptions\n </li>\n </ul>\n </div>`,\n },\n deleteScaleDialogBoxContent: {\n title: 'Delete Scale',\n text: 'Are you sure you want to delete this scale?',\n },\n maxPointsDialogBoxContent: {\n title: 'Decreasing Max Points.',\n text: ` You are about to decrease max score point value.\n <br/>\n All the Labels and Descriptions for scores above Max Point will be deleted.`,\n },\n spellCheck: {\n label: 'Spellcheck',\n settings: false,\n enabled: true,\n },\n showExcludeZero: {\n settings: true,\n label: 'Exclude Zero',\n },\n showScorePointLabels: {\n settings: true,\n label: 'Show Score Point Labels',\n },\n showDescription: {\n settings: true,\n label: 'Show Description',\n },\n showVisibleToStudent: {\n settings: true,\n label: 'Visible to Student',\n },\n showHalfScoring: {\n settings: true,\n label: 'Half Scoring',\n },\n width: '900px',\n // these should not be set to true (should not be used) for now\n showStandards: {\n settings: false,\n label: 'Show Standards',\n },\n showLevelTagInput: {\n settings: false,\n label: 'Show Level Tag Input',\n enabled: false,\n },\n dragAndDrop: {\n settings: true,\n label: 'Enable Drag and Drop',\n enabled: false,\n },\n};\n\nconst rubricDefaultConfiguration = {\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};\n\nexport default {\n model: {\n rubricType: 'simpleRubric',\n rubrics: { simpleRubric: rubricDefaultModel, multiTraitRubric: multiTraitDefaultModel },\n },\n configuration: {\n multiTraitRubric: multiTraitDefaultConfiguration,\n simpleRubric: rubricDefaultConfiguration,\n },\n};\n"],"file":"defaults.js"}
|
package/controller/lib/index.js
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.createCorrectResponseSession = void 0;
|
|
9
|
-
exports.createDefaultModel = createDefaultModel;
|
|
10
|
-
exports.getScore = void 0;
|
|
11
|
-
exports.model = model;
|
|
12
|
-
exports.normalize = void 0;
|
|
13
|
-
exports.outcome = outcome;
|
|
14
|
-
|
|
15
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
16
|
-
|
|
17
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
18
|
-
|
|
19
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
20
|
-
|
|
21
|
-
var _defaults = _interopRequireDefault(require("./defaults"));
|
|
22
|
-
|
|
23
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
24
|
-
|
|
25
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
26
|
-
|
|
27
|
-
// todo the import from pie-lib/rubric might break webpack
|
|
28
|
-
var RUBRIC_TYPES = {
|
|
29
|
-
SIMPLE_RUBRIC: 'simpleRubric',
|
|
30
|
-
MULTI_TRAIT_RUBRIC: 'multiTraitRubric'
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
function createDefaultModel() {
|
|
34
|
-
var model = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
35
|
-
return new Promise(function (resolve) {
|
|
36
|
-
return resolve(_objectSpread(_objectSpread({}, _defaults["default"].model), model));
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
var normalize = function normalize(question) {
|
|
41
|
-
return _objectSpread(_objectSpread({}, _defaults["default"].model), question);
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* @param {*} question
|
|
45
|
-
* @param {*} session
|
|
46
|
-
* @param {*} env
|
|
47
|
-
*/
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
exports.normalize = normalize;
|
|
51
|
-
|
|
52
|
-
function model(_x, _x2, _x3) {
|
|
53
|
-
return _model.apply(this, arguments);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function _model() {
|
|
57
|
-
_model = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(question, session, env) {
|
|
58
|
-
var normalizedQuestion, _ref, scales, excludeZero, parsedScales;
|
|
59
|
-
|
|
60
|
-
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
61
|
-
while (1) {
|
|
62
|
-
switch (_context.prev = _context.next) {
|
|
63
|
-
case 0:
|
|
64
|
-
normalizedQuestion = normalize(question);
|
|
65
|
-
|
|
66
|
-
if (!(normalizedQuestion.rubricType === RUBRIC_TYPES.SIMPLE_RUBRIC)) {
|
|
67
|
-
_context.next = 5;
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return _context.abrupt("return", new Promise(function (resolve) {
|
|
72
|
-
resolve(env && env.role && env.role === 'instructor' ? _objectSpread(_objectSpread({}, normalizedQuestion), {}, {
|
|
73
|
-
rubrics: _objectSpread(_objectSpread({}, normalizedQuestion.rubrics), {}, {
|
|
74
|
-
multiTraitRubric: _objectSpread(_objectSpread({}, normalizedQuestion.rubrics.multiTraitRubric), {}, {
|
|
75
|
-
visible: false
|
|
76
|
-
})
|
|
77
|
-
})
|
|
78
|
-
}) : {});
|
|
79
|
-
}));
|
|
80
|
-
|
|
81
|
-
case 5:
|
|
82
|
-
if (!env.role || env.role === 'student' && normalizedQuestion.rubrics && normalizedQuestion.rubrics.multiTraitRubric) {
|
|
83
|
-
normalizedQuestion.rubrics.multiTraitRubric.visible = normalizedQuestion.visibleToStudent;
|
|
84
|
-
} else {
|
|
85
|
-
normalizedQuestion.rubrics.multiTraitRubric.visible = true;
|
|
86
|
-
} // todo update pie-ui instead of parsing this here:
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
_ref = normalizedQuestion.rubrics.multiTraitRubric || {}, scales = _ref.scales, excludeZero = _ref.excludeZero;
|
|
90
|
-
parsedScales = (scales || []).map(function (scale) {
|
|
91
|
-
return _objectSpread(_objectSpread({}, scale), {}, {
|
|
92
|
-
excludeZero: excludeZero
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
return _context.abrupt("return", _objectSpread(_objectSpread({}, normalizedQuestion), {}, {
|
|
96
|
-
rubrics: _objectSpread(_objectSpread({}, normalizedQuestion.rubrics), {}, {
|
|
97
|
-
simpleRubric: _objectSpread(_objectSpread({}, normalizedQuestion.rubrics.simpleRubric), {}, {
|
|
98
|
-
visible: false
|
|
99
|
-
}),
|
|
100
|
-
multiTraitRubric: _objectSpread(_objectSpread({}, normalizedQuestion.rubrics.multiTraitRubric), {}, {
|
|
101
|
-
scales: parsedScales
|
|
102
|
-
})
|
|
103
|
-
})
|
|
104
|
-
}));
|
|
105
|
-
|
|
106
|
-
case 9:
|
|
107
|
-
case "end":
|
|
108
|
-
return _context.stop();
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}, _callee);
|
|
112
|
-
}));
|
|
113
|
-
return _model.apply(this, arguments);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
var getScore = function getScore() {
|
|
117
|
-
return 0;
|
|
118
|
-
};
|
|
119
|
-
/**
|
|
120
|
-
* @param {Object} model - the main model
|
|
121
|
-
* @param {*} session
|
|
122
|
-
* @param {Object} env
|
|
123
|
-
*/
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
exports.getScore = getScore;
|
|
127
|
-
|
|
128
|
-
function outcome() {
|
|
129
|
-
return new Promise(function (resolve) {
|
|
130
|
-
return resolve({
|
|
131
|
-
score: 0,
|
|
132
|
-
empty: true
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
var createCorrectResponseSession = function createCorrectResponseSession(question, env) {
|
|
138
|
-
return new Promise(function (resolve) {
|
|
139
|
-
if (env.mode !== 'evaluate' && env.role === 'instructor') {
|
|
140
|
-
resolve({
|
|
141
|
-
id: '1'
|
|
142
|
-
});
|
|
143
|
-
} else {
|
|
144
|
-
resolve(null);
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
exports.createCorrectResponseSession = createCorrectResponseSession;
|
|
150
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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","role","rubrics","multiTraitRubric","visible","visibleToStudent","scales","excludeZero","parsedScales","map","scale","simpleRubric","getScore","outcome","score","empty","createCorrectResponseSession","mode","id"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;AAEA;AACA,IAAMA,YAAY,GAAG;AACnBC,EAAAA,aAAa,EAAE,cADI;AAEnBC,EAAAA,kBAAkB,EAAE;AAFD,CAArB;;AAKO,SAASC,kBAAT,GAAwC;AAAA,MAAZC,KAAY,uEAAJ,EAAI;AAC7C,SAAO,IAAIC,OAAJ,CAAY,UAACC,OAAD;AAAA,WAAaA,OAAO,iCAAMC,qBAASH,KAAf,GAAyBA,KAAzB,EAApB;AAAA,GAAZ,CAAP;AACD;;AAEM,IAAMI,SAAS,GAAG,SAAZA,SAAY,CAACC,QAAD;AAAA,yCAAoBF,qBAASH,KAA7B,GAAuCK,QAAvC;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,kBAGDG,kBAAkB,CAACC,UAAnB,KAAkCb,YAAY,CAACC,aAH9C;AAAA;AAAA;AAAA;;AAAA,6CAII,IAAII,OAAJ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B,kCACXJ,kBAAkB,CAACG,OAAnB,CAA2BC,gBADhB;AAEdG,kBAAAA,MAAM,EAAEE;AAFM;AANX;AApCN;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G;;;;AAmDA,IAAMI,QAAQ,GAAG,SAAXA,QAAW;AAAA,SAAM,CAAN;AAAA,CAAjB;AAEP;AACA;AACA;AACA;AACA;;;;;AACO,SAASC,OAAT,GAAmB;AACxB,SAAO,IAAIrB,OAAJ,CAAY,UAACC,OAAD;AAAA,WAAaA,OAAO,CAAC;AAAEqB,MAAAA,KAAK,EAAE,CAAT;AAAYC,MAAAA,KAAK,EAAE;AAAnB,KAAD,CAApB;AAAA,GAAZ,CAAP;AACD;;AAEM,IAAMC,4BAA4B,GAAG,SAA/BA,4BAA+B,CAACpB,QAAD,EAAWE,GAAX,EAAmB;AAC7D,SAAO,IAAIN,OAAJ,CAAY,UAACC,OAAD,EAAa;AAC9B,QAAIK,GAAG,CAACmB,IAAJ,KAAa,UAAb,IAA2BnB,GAAG,CAACG,IAAJ,KAAa,YAA5C,EAA0D;AACxDR,MAAAA,OAAO,CAAC;AAAEyB,QAAAA,EAAE,EAAE;AAAN,OAAD,CAAP;AACD,KAFD,MAEO;AACLzB,MAAAA,OAAO,CAAC,IAAD,CAAP;AACD;AACF,GANM,CAAP;AAOD,CARM","sourcesContent":["import defaults from './defaults';\n\n// todo the import from pie-lib/rubric might break webpack\nconst RUBRIC_TYPES = {\n SIMPLE_RUBRIC: 'simpleRubric',\n MULTI_TRAIT_RUBRIC: 'multiTraitRubric',\n};\n\nexport function createDefaultModel(model = {}) {\n return new Promise((resolve) => resolve({ ...defaults.model, ...model }));\n}\n\nexport const normalize = (question) => ({ ...defaults.model, ...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 (normalizedQuestion.rubricType === RUBRIC_TYPES.SIMPLE_RUBRIC) {\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 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"],"file":"index.js"}
|