Skip to content
Permalink
Browse files

show base marking algorithm above custom one

when "extend base marking algorithm" is ticked
  • Loading branch information...
christianp committed Jul 3, 2018
1 parent f5c1ddd commit 459de164163c2ce636b1e52caf457b9a194659e9
@@ -144,6 +144,12 @@
font-family: inherit;
}

.base-marking-algorithm pre {
max-height: 20em;
overflow-y: auto;
margin-bottom: 1em;
}

.marking-test .nav-tabs,
.unit-test .nav-tabs {
margin-bottom: 1em;

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -9003,6 +9003,7 @@ Numbas.queueScript('marking',['jme','localisation','jme-variables'],function() {
* @property {Numbas.marking.MarkingNote[]} notes
*/
var MarkingScript = marking.MarkingScript = function(source, base) {
this.source = source;
try {
var notes = source.split(/\n(\s*\n)+/);
var ntodo = {};
@@ -9030,6 +9031,11 @@ Numbas.queueScript('marking',['jme','localisation','jme-variables'],function() {
}
MarkingScript.prototype = /** @lends Numbas.marking.MarkingScript.prototype */ {

/** The source code of the script
* @type {String}
*/
source: '',

/** Evaluate all of this script's notes in the given scope.
*
* @param {Numbas.jme.Scope} scope
@@ -1948,6 +1948,15 @@ $(document).ready(function() {
this.use_custom_algorithm = ko.observable(false);
this.customMarkingAlgorithm = ko.observable('');
this.extendBaseMarkingAlgorithm = ko.observable(true);
this.baseMarkingAlgorithm = ko.computed(function() {
var type = this.type();
if(type.is_custom_part_type) {
return Numbas.custom_part_types[type.name].marking_script;
} else {
var script = Numbas.partConstructors[type.name].prototype.markingScript;
return script ? script.source : '';
}
},this);

this.markingScriptError = ko.observable('');
this.markingScript = ko.computed(function() {
@@ -483,6 +483,11 @@ <h3>

<div data-bind="fadeVisible: use_custom_algorithm">
{% booleanproperty 'extendBaseMarkingAlgorithm' 'Extend base marking algorithm?' help_url='question/parts/reference.html#term-extend-base-marking-algorithm' %}
<div class="base-marking-algorithm" data-bind="fadeVisible: extendBaseMarkingAlgorithm">
<h5>Base marking algorithm</h5>
<pre data-bind="text: baseMarkingAlgorithm"></pre>
</div>
<h5>Custom marking algorithm</h5>
<textarea {% if not editable %}disabled{% endif %} data-bind="codemirror: customMarkingAlgorithm, codemirrorMode: 'jme'"></textarea>
<p class="alert alert-danger" data-bind="html: markingScriptError, visible: markingScriptError"></p>
</div>

0 comments on commit 459de16

Please sign in to comment.
You can’t perform that action at this time.