@pie-element/complex-rubric 3.8.4-next.0 → 3.8.4-next.12

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.
Files changed (121) hide show
  1. package/configure/node_modules/@pie-element/multi-trait-rubric/CHANGELOG.json +1 -0
  2. package/configure/node_modules/@pie-element/multi-trait-rubric/CHANGELOG.md +2430 -0
  3. package/configure/node_modules/@pie-element/multi-trait-rubric/LICENSE.md +5 -0
  4. package/configure/node_modules/@pie-element/multi-trait-rubric/README.md +55 -0
  5. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/CHANGELOG.json +1 -0
  6. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/CHANGELOG.md +2298 -0
  7. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/common.js +584 -0
  8. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/common.js.map +1 -0
  9. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/defaults.js +152 -0
  10. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/defaults.js.map +1 -0
  11. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/index.js +223 -0
  12. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/index.js.map +1 -0
  13. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/main.js +546 -0
  14. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/main.js.map +1 -0
  15. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/modals.js +361 -0
  16. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/modals.js.map +1 -0
  17. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/scale.js +556 -0
  18. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/scale.js.map +1 -0
  19. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/trait.js +380 -0
  20. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/trait.js.map +1 -0
  21. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/traitsHeader.js +296 -0
  22. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/traitsHeader.js.map +1 -0
  23. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/utils.js +118 -0
  24. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/utils.js.map +1 -0
  25. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/package.json +18 -0
  26. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/CHANGELOG.json +1 -0
  27. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/CHANGELOG.md +1539 -0
  28. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/defaults.js +19 -0
  29. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/defaults.js.map +1 -0
  30. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/index.js +215 -0
  31. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/index.js.map +1 -0
  32. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/utils.js +13 -0
  33. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/utils.js.map +1 -0
  34. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/package.json +15 -0
  35. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/config-schema.json +1628 -0
  36. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/config-schema.json.md +1202 -0
  37. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/config.js +8 -0
  38. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/generate.js +117 -0
  39. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/index.html +1 -0
  40. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/session.js +6 -0
  41. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/pie-schema.json +861 -0
  42. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/pie-schema.json.md +614 -0
  43. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/index.js +91 -0
  44. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/index.js.map +1 -0
  45. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/main.js +164 -0
  46. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/main.js.map +1 -0
  47. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/scale.js +330 -0
  48. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/scale.js.map +1 -0
  49. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/trait.js +103 -0
  50. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/trait.js.map +1 -0
  51. package/configure/node_modules/@pie-element/multi-trait-rubric/package.json +24 -0
  52. package/configure/node_modules/@pie-element/rubric/CHANGELOG.json +257 -0
  53. package/configure/node_modules/@pie-element/rubric/CHANGELOG.md +2713 -0
  54. package/configure/node_modules/@pie-element/rubric/LICENSE.md +5 -0
  55. package/configure/node_modules/@pie-element/rubric/README.md +3 -0
  56. package/configure/node_modules/@pie-element/rubric/configure/CHANGELOG.json +197 -0
  57. package/configure/node_modules/@pie-element/rubric/configure/CHANGELOG.md +2506 -0
  58. package/configure/node_modules/@pie-element/rubric/configure/lib/defaults.js +68 -0
  59. package/configure/node_modules/@pie-element/rubric/configure/lib/defaults.js.map +1 -0
  60. package/configure/node_modules/@pie-element/rubric/configure/lib/index.js +197 -0
  61. package/configure/node_modules/@pie-element/rubric/configure/lib/index.js.map +1 -0
  62. package/configure/node_modules/@pie-element/rubric/configure/lib/main.js +162 -0
  63. package/configure/node_modules/@pie-element/rubric/configure/lib/main.js.map +1 -0
  64. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/authoring.js +573 -0
  65. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/authoring.js.map +1 -0
  66. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/index.js +24 -0
  67. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/index.js.map +1 -0
  68. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/point-menu.js +172 -0
  69. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/point-menu.js.map +1 -0
  70. package/configure/node_modules/@pie-element/rubric/configure/package.json +18 -0
  71. package/configure/node_modules/@pie-element/rubric/configure/src/__tests__/index.test.jsx +167 -0
  72. package/configure/node_modules/@pie-element/rubric/configure/src/defaults.js +42 -0
  73. package/configure/node_modules/@pie-element/rubric/configure/src/index.js +129 -0
  74. package/configure/node_modules/@pie-element/rubric/configure/src/main.jsx +89 -0
  75. package/configure/node_modules/@pie-element/rubric/configure/src/pie-toolbox-rubric/authoring.jsx +449 -0
  76. package/configure/node_modules/@pie-element/rubric/configure/src/pie-toolbox-rubric/index.js +9 -0
  77. package/configure/node_modules/@pie-element/rubric/configure/src/pie-toolbox-rubric/point-menu.jsx +94 -0
  78. package/configure/node_modules/@pie-element/rubric/controller/CHANGELOG.json +17 -0
  79. package/configure/node_modules/@pie-element/rubric/controller/CHANGELOG.md +1532 -0
  80. package/configure/node_modules/@pie-element/rubric/controller/lib/defaults.js +16 -0
  81. package/configure/node_modules/@pie-element/rubric/controller/lib/defaults.js.map +1 -0
  82. package/configure/node_modules/@pie-element/rubric/controller/lib/index.js +59 -0
  83. package/configure/node_modules/@pie-element/rubric/controller/lib/index.js.map +1 -0
  84. package/configure/node_modules/@pie-element/rubric/controller/package.json +13 -0
  85. package/configure/node_modules/@pie-element/rubric/controller/src/__tests__/index.test.js +33 -0
  86. package/configure/node_modules/@pie-element/rubric/controller/src/defaults.js +8 -0
  87. package/configure/node_modules/@pie-element/rubric/controller/src/index.js +41 -0
  88. package/configure/node_modules/@pie-element/rubric/docs/config-schema.json +712 -0
  89. package/configure/node_modules/@pie-element/rubric/docs/config-schema.json.md +532 -0
  90. package/configure/node_modules/@pie-element/rubric/docs/demo/config.js +8 -0
  91. package/configure/node_modules/@pie-element/rubric/docs/demo/generate.js +8 -0
  92. package/configure/node_modules/@pie-element/rubric/docs/demo/index.html +2 -0
  93. package/configure/node_modules/@pie-element/rubric/docs/pie-schema.json +391 -0
  94. package/configure/node_modules/@pie-element/rubric/docs/pie-schema.json.md +281 -0
  95. package/configure/node_modules/@pie-element/rubric/lib/index.js +94 -0
  96. package/configure/node_modules/@pie-element/rubric/lib/index.js.map +1 -0
  97. package/configure/node_modules/@pie-element/rubric/lib/main.js +270 -0
  98. package/configure/node_modules/@pie-element/rubric/lib/main.js.map +1 -0
  99. package/configure/node_modules/@pie-element/rubric/lib/print.js +114 -0
  100. package/configure/node_modules/@pie-element/rubric/lib/print.js.map +1 -0
  101. package/configure/node_modules/@pie-element/rubric/module/configure.js +1 -0
  102. package/configure/node_modules/@pie-element/rubric/module/controller.js +113 -0
  103. package/configure/node_modules/@pie-element/rubric/module/demo.js +33 -0
  104. package/configure/node_modules/@pie-element/rubric/module/element.js +1 -0
  105. package/configure/node_modules/@pie-element/rubric/module/index.html +21 -0
  106. package/configure/node_modules/@pie-element/rubric/module/manifest.json +10 -0
  107. package/configure/node_modules/@pie-element/rubric/module/print-demo.js +71 -0
  108. package/configure/node_modules/@pie-element/rubric/module/print.html +18 -0
  109. package/configure/node_modules/@pie-element/rubric/module/print.js +1 -0
  110. package/configure/node_modules/@pie-element/rubric/package.json +26 -0
  111. package/configure/node_modules/@pie-element/rubric/src/__tests__/__snapshots__/rubric-view.test.jsx.snap +1815 -0
  112. package/configure/node_modules/@pie-element/rubric/src/__tests__/rubric-view.test.jsx +49 -0
  113. package/configure/node_modules/@pie-element/rubric/src/index.js +37 -0
  114. package/configure/node_modules/@pie-element/rubric/src/main.jsx +219 -0
  115. package/configure/node_modules/@pie-element/rubric/src/print.js +63 -0
  116. package/module/element.js +1 -1
  117. package/module/index.html +1 -1
  118. package/module/manifest.json +5 -1
  119. package/module/print.html +1 -1
  120. package/module/print.js +1 -1
  121. package/package.json +4 -4
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _default = {
8
+ addScaleEnabled: true,
9
+ description: false,
10
+ excludeZero: false,
11
+ halfScoring: false,
12
+ maxPointsEnabled: true,
13
+ pointLabels: true,
14
+ scales: [],
15
+ standards: false,
16
+ visibleToStudent: true
17
+ };
18
+ exports["default"] = _default;
19
+ //# sourceMappingURL=defaults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/defaults.js"],"names":["addScaleEnabled","description","excludeZero","halfScoring","maxPointsEnabled","pointLabels","scales","standards","visibleToStudent"],"mappings":";;;;;;eAAe;AACbA,EAAAA,eAAe,EAAE,IADJ;AAEbC,EAAAA,WAAW,EAAE,KAFA;AAGbC,EAAAA,WAAW,EAAE,KAHA;AAIbC,EAAAA,WAAW,EAAE,KAJA;AAKbC,EAAAA,gBAAgB,EAAE,IALL;AAMbC,EAAAA,WAAW,EAAE,IANA;AAObC,EAAAA,MAAM,EAAE,EAPK;AAQbC,EAAAA,SAAS,EAAE,KARE;AASbC,EAAAA,gBAAgB,EAAE;AATL,C","sourcesContent":["export default {\n addScaleEnabled: true,\n description: false,\n excludeZero: false,\n halfScoring: false,\n maxPointsEnabled: true,\n pointLabels: true,\n scales: [],\n standards: false,\n visibleToStudent: true,\n};\n"],"file":"defaults.js"}
@@ -0,0 +1,215 @@
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
+ exports.validate = void 0;
15
+
16
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
17
+
18
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
19
+
20
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
21
+
22
+ var _defaults = _interopRequireDefault(require("./defaults"));
23
+
24
+ var _utils = require("./utils");
25
+
26
+ 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; }
27
+
28
+ 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; }
29
+
30
+ function createDefaultModel() {
31
+ var model = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
32
+ return new Promise(function (resolve) {
33
+ return resolve(_objectSpread(_objectSpread({}, _defaults["default"]), model));
34
+ });
35
+ }
36
+
37
+ var normalize = function normalize(question) {
38
+ return _objectSpread(_objectSpread({}, _defaults["default"]), question);
39
+ };
40
+ /**
41
+ *
42
+ * @param {*} question
43
+ * @param {*} session
44
+ * @param {*} env
45
+ */
46
+
47
+
48
+ exports.normalize = normalize;
49
+
50
+ function model(_x, _x2, _x3) {
51
+ return _model.apply(this, arguments);
52
+ }
53
+
54
+ function _model() {
55
+ _model = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(question, session, env) {
56
+ var normalizedQuestion, _ref, scales, excludeZero, parsedScales;
57
+
58
+ return _regenerator["default"].wrap(function _callee$(_context) {
59
+ while (1) {
60
+ switch (_context.prev = _context.next) {
61
+ case 0:
62
+ normalizedQuestion = normalize(question);
63
+
64
+ if (!env.role || env.role === 'student') {
65
+ normalizedQuestion.visible = normalizedQuestion.visibleToStudent;
66
+ } else {
67
+ normalizedQuestion.visible = true;
68
+ } // todo update pie-ui instead of parsing this here:
69
+
70
+
71
+ _ref = normalizedQuestion || {}, scales = _ref.scales, excludeZero = _ref.excludeZero;
72
+ parsedScales = (scales || []).map(function (scale) {
73
+ return _objectSpread(_objectSpread({}, scale), {}, {
74
+ excludeZero: excludeZero
75
+ });
76
+ });
77
+ return _context.abrupt("return", _objectSpread(_objectSpread({}, normalizedQuestion), {}, {
78
+ scales: parsedScales
79
+ }));
80
+
81
+ case 5:
82
+ case "end":
83
+ return _context.stop();
84
+ }
85
+ }
86
+ }, _callee);
87
+ }));
88
+ return _model.apply(this, arguments);
89
+ }
90
+
91
+ var getScore = function getScore() {
92
+ return 0;
93
+ };
94
+ /**
95
+ * @param {Object} model - the main model
96
+ * @param {*} session
97
+ * @param {Object} env
98
+ */
99
+
100
+
101
+ exports.getScore = getScore;
102
+
103
+ function outcome() {
104
+ return new Promise(function (resolve) {
105
+ return resolve({
106
+ score: 0,
107
+ empty: true
108
+ });
109
+ });
110
+ }
111
+
112
+ var createCorrectResponseSession = function createCorrectResponseSession(question, env) {
113
+ return new Promise(function (resolve) {
114
+ if (env.mode !== 'evaluate' && env.role === 'instructor') {
115
+ resolve({
116
+ id: '1'
117
+ });
118
+ } else {
119
+ resolve(null);
120
+ }
121
+ });
122
+ }; // IMPORTANT! If you make any changes to this function, please make sure you also update complex-rubric/controller/validateMultiTraitRubric function!“.
123
+
124
+
125
+ exports.createCorrectResponseSession = createCorrectResponseSession;
126
+
127
+ var validate = function validate(model, config) {
128
+ var scales = model.scales,
129
+ _model$description = model.description,
130
+ description = _model$description === void 0 ? false : _model$description,
131
+ _model$pointLabels = model.pointLabels,
132
+ pointLabels = _model$pointLabels === void 0 ? false : _model$pointLabels;
133
+ var errors = {};
134
+ var traitsErrors = {};
135
+ var scorePointsErrors = {};
136
+ (scales || []).forEach(function (scale, scaleIndex) {
137
+ var _scale$traits = scale.traits,
138
+ traits = _scale$traits === void 0 ? [] : _scale$traits;
139
+ var _scale$scorePointsLab = scale.scorePointsLabels,
140
+ scorePointsLabels = _scale$scorePointsLab === void 0 ? [] : _scale$scorePointsLab;
141
+ var scaleErrors = {};
142
+ var scorePointsLabelsErrors = {};
143
+
144
+ if (pointLabels) {
145
+ scorePointsLabels.forEach(function (scorePointLabel, scoreIndex) {
146
+ if (!scorePointLabel || scorePointLabel === '<div></div>') {
147
+ scorePointsLabelsErrors[scoreIndex] = 'Points labels should not be empty.';
148
+ } else {
149
+ var identicalScorePointLabel = scorePointsLabels.slice(scoreIndex + 1).some(function (s) {
150
+ return (0, _utils.markupToText)(s) === (0, _utils.markupToText)(scorePointLabel);
151
+ });
152
+
153
+ if (identicalScorePointLabel) {
154
+ scorePointsLabelsErrors[scoreIndex] = 'Points labels should be unique.';
155
+ }
156
+ }
157
+ });
158
+ }
159
+
160
+ if (Object.keys(scorePointsLabelsErrors).length > 0) {
161
+ scorePointsErrors[scaleIndex] = scorePointsLabelsErrors;
162
+ }
163
+
164
+ traits.forEach(function (trait, traitIndex) {
165
+ if (!trait.name || trait.name === '<div></div>') {
166
+ scaleErrors[traitIndex] = {
167
+ name: 'Trait names should not be empty.'
168
+ };
169
+ } else {
170
+ var identicalTraitName = traits.slice(traitIndex + 1).some(function (t) {
171
+ return (0, _utils.markupToText)(t.name) === (0, _utils.markupToText)(trait.name);
172
+ });
173
+
174
+ if (identicalTraitName) {
175
+ scaleErrors[traitIndex] = {
176
+ name: 'Trait names should be unique.'
177
+ };
178
+ }
179
+ }
180
+
181
+ if (description && (!trait.description || trait.description === '<div></div>')) {
182
+ scaleErrors[traitIndex] = _objectSpread(_objectSpread({}, scaleErrors[traitIndex]), {}, {
183
+ description: 'Trait description should not be empty'
184
+ });
185
+ } else {
186
+ var identicalTraitDescr = traits.slice(traitIndex + 1).some(function (t) {
187
+ return (0, _utils.markupToText)(t.description) === (0, _utils.markupToText)(trait.description);
188
+ });
189
+
190
+ if (description && identicalTraitDescr) {
191
+ scaleErrors[traitIndex] = _objectSpread(_objectSpread({}, scaleErrors[traitIndex]), {}, {
192
+ description: 'Trait descriptions should be unique.'
193
+ });
194
+ }
195
+ }
196
+ });
197
+
198
+ if (Object.keys(scaleErrors).length > 0) {
199
+ traitsErrors[scaleIndex] = scaleErrors;
200
+ }
201
+ });
202
+
203
+ if (Object.keys(traitsErrors).length > 0) {
204
+ errors.traitsErrors = traitsErrors;
205
+ }
206
+
207
+ if (Object.keys(scorePointsErrors).length > 0) {
208
+ errors.scorePointsErrors = scorePointsErrors;
209
+ }
210
+
211
+ return errors;
212
+ };
213
+
214
+ exports.validate = validate;
215
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.js"],"names":["createDefaultModel","model","Promise","resolve","defaults","normalize","question","session","env","normalizedQuestion","role","visible","visibleToStudent","scales","excludeZero","parsedScales","map","scale","getScore","outcome","score","empty","createCorrectResponseSession","mode","id","validate","config","description","pointLabels","errors","traitsErrors","scorePointsErrors","forEach","scaleIndex","traits","scorePointsLabels","scaleErrors","scorePointsLabelsErrors","scorePointLabel","scoreIndex","identicalScorePointLabel","slice","some","s","Object","keys","length","trait","traitIndex","name","identicalTraitName","t","identicalTraitDescr"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;;;;;AAEO,SAASA,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;AACA;;;;;SACsBL,K;;;;;yFAAf,iBAAqBK,QAArB,EAA+BC,OAA/B,EAAwCC,GAAxC;AA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CAAC,CAACxB,WAAf,MAAgC,yBAAaoB,KAAK,CAACpB,WAAnB,CAAvC;AAAA,SAFoB,CAA5B;;AAIA,YAAIA,WAAW,IAAIyB,mBAAnB,EAAwC;AACtChB,UAAAA,WAAW,CAACY,UAAD,CAAX,mCAA+BZ,WAAW,CAACY,UAAD,CAA1C;AAAwDrB,YAAAA,WAAW,EAAE;AAArE;AACD;AACF;AACF,KAvBD;;AAwBA,QAAIiB,MAAM,CAACC,IAAP,CAAYT,WAAZ,EAAyBU,MAAzB,GAAkC,CAAtC,EAAyC;AACvChB,MAAAA,YAAY,CAACG,UAAD,CAAZ,GAA2BG,WAA3B;AACD;AACF,GArDD;;AAuDA,MAAIQ,MAAM,CAACC,IAAP,CAAYf,YAAZ,EAA0BgB,MAA1B,GAAmC,CAAvC,EAA0C;AACxCjB,IAAAA,MAAM,CAACC,YAAP,GAAsBA,YAAtB;AACD;;AAED,MAAIc,MAAM,CAACC,IAAP,CAAYd,iBAAZ,EAA+Be,MAA/B,GAAwC,CAA5C,EAA+C;AAC7CjB,IAAAA,MAAM,CAACE,iBAAP,GAA2BA,iBAA3B;AACD;;AAED,SAAOF,MAAP;AACD,CAtEM","sourcesContent":["import defaults from './defaults';\nimport { markupToText } from './utils';\n\nexport function createDefaultModel(model = {}) {\n return new Promise((resolve) => resolve({ ...defaults, ...model }));\n}\n\nexport const normalize = (question) => ({ ...defaults, ...question });\n\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 (!env.role || env.role === 'student') {\n normalizedQuestion.visible = normalizedQuestion.visibleToStudent;\n } else {\n normalizedQuestion.visible = true;\n }\n\n // todo update pie-ui instead of parsing this here:\n const { scales, excludeZero } = normalizedQuestion || {};\n const parsedScales = (scales || []).map((scale) => ({ ...scale, excludeZero }));\n\n return {\n ...normalizedQuestion,\n scales: parsedScales,\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! If you make any changes to this function, please make sure you also update complex-rubric/controller/validateMultiTraitRubric function!“.\nexport const validate = (model, config) => {\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"],"file":"index.js"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.markupToText = void 0;
7
+
8
+ var markupToText = function markupToText(s) {
9
+ return (s || '').replace(/(<([^>]+)>)/ig, '');
10
+ };
11
+
12
+ exports.markupToText = markupToText;
13
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils.js"],"names":["markupToText","s","replace"],"mappings":";;;;;;;AAAO,IAAMA,YAAY,GAAG,SAAfA,YAAe,CAACC,CAAD,EAAO;AAC/B,SAAO,CAACA,CAAC,IAAI,EAAN,EAAUC,OAAV,CAAkB,eAAlB,EAAmC,EAAnC,CAAP;AACH,CAFM","sourcesContent":["export const markupToText = (s) => {\n return (s || '').replace(/(<([^>]+)>)/ig, '');\n};\n"],"file":"utils.js"}
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@pie-element/multi-trait-rubric-controller",
3
+ "private": true,
4
+ "version": "3.3.2",
5
+ "description": "",
6
+ "main": "lib/index.js",
7
+ "module": "src/index.js",
8
+ "author": "",
9
+ "license": "ISC",
10
+ "dependencies": {
11
+ "@pie-lib/pie-toolbox": "2.25.2",
12
+ "debug": "^3.1.0",
13
+ "lodash": "^4.17.15"
14
+ }
15
+ }