Files
edx-platform/xmodule/capa/tests/test_files/js/xproblem.js
Soban Javed 9eba9f983a refactor!: move common/lib/capa/capa to xmodule/capa
As part of dissolving our sub-projects in edx-platform, we are moving this package under the xmodule directory.
We have fixed all the occurences of import of this package and also fixed all documents related references.
This might break your platform if you have any reference of `import capa` or `from capa import` in your codebase or in any Xblock.

Ref: https://openedx.atlassian.net/browse/BOM-2582
2022-07-19 12:20:04 +05:00

79 lines
1.8 KiB
JavaScript

/*
* decaffeinate suggestions:
* DS207: Consider shorter variations of null checks
* DS208: Avoid top-level this
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
class XProblemGenerator {
constructor(seed, parameters) {
if (parameters == null) { parameters = {}; }
this.parameters = parameters;
this.random = new MersenneTwister(seed);
this.problemState = {};
}
generate() {
console.error("Abstract method called: XProblemGenerator.generate");
}
}
class XProblemDisplay {
constructor(state, submission, evaluation, container, submissionField, parameters) {
this.state = state;
this.submission = submission;
this.evaluation = evaluation;
this.container = container;
this.submissionField = submissionField;
if (parameters == null) { parameters = {}; }
this.parameters = parameters;
}
render() {
console.error("Abstract method called: XProblemDisplay.render");
}
updateSubmission() {
this.submissionField.val(JSON.stringify(this.getCurrentSubmission()));
}
getCurrentSubmission() {
console.error("Abstract method called: XProblemDisplay.getCurrentSubmission");
}
}
class XProblemGrader {
constructor(submission, problemState, parameters) {
this.submission = submission;
this.problemState = problemState;
if (parameters == null) { parameters = {}; }
this.parameters = parameters;
this.solution = null;
this.evaluation = {};
}
solve() {
console.error("Abstract method called: XProblemGrader.solve");
}
grade() {
console.error("Abstract method called: XProblemGrader.grade");
}
}
const root = typeof exports !== 'undefined' && exports !== null ? exports : this;
root.XProblemGenerator = XProblemGenerator;
root.XProblemDisplay = XProblemDisplay;
root.XProblemGrader = XProblemGrader;