X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/ca531bd353bd00ebe786c63df893f7f71167411b..6f1b6c8ed3980bad95c67be4709dc8e62ba4a593:/redakcja/static/edumed/js/edumed.js?ds=inline diff --git a/redakcja/static/edumed/js/edumed.js b/redakcja/static/edumed/js/edumed.js index aec1c4cb..be942174 100644 --- a/redakcja/static/edumed/js/edumed.js +++ b/redakcja/static/edumed/js/edumed.js @@ -77,7 +77,7 @@ Excercise.prototype.get_value_list = function(elem, data_key, numbers) { var vl; - vl = $(elem).data(data_key).split(/[ ,]+/).map($.trim); + vl = $(elem).attr("data-" + data_key).split(/[ ,]+/).map($.trim); if (numbers) { vl = vl.map(function(x) { return parseInt(x); @@ -123,11 +123,16 @@ _this = this; all = 0; good = 0; - solution = this.get_value_list(question, 'solution', true); + solution = this.get_value_list(question, 'solution'); $(".question-piece", question).each(function(i, qpiece) { - var is_checked, piece_no, should_be_checked; - piece_no = parseInt($(qpiece).attr('data-no')); - should_be_checked = solution.indexOf(piece_no) >= 0; + var is_checked, piece_name, piece_no, should_be_checked; + piece_no = $(qpiece).attr('data-no'); + piece_name = $(qpiece).attr('data-name'); + if (piece_name) { + should_be_checked = solution.indexOf(piece_name) >= 0; + } else { + should_be_checked = solution.indexOf(piece_no) >= 0; + } is_checked = $("input", qpiece).is(":checked"); if (should_be_checked) all += 1; if (is_checked) {