From: Marcin Koziej Date: Fri, 11 Jan 2013 11:41:30 +0000 (+0100) Subject: Fix wybor X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/3acdb5c1daebfd692344bb93cd8d0594607caa9b?ds=sidebyside Fix wybor --- diff --git a/lib/librarian b/lib/librarian index ab001bc3..e569d710 160000 --- a/lib/librarian +++ b/lib/librarian @@ -1 +1 @@ -Subproject commit ab001bc37c0f8ee0bb92b8762f5151b5b93f6ccc +Subproject commit e569d71063fb6647885ec65abda89d2843be876d diff --git a/redakcja/static/edumed/js/edumed.coffee b/redakcja/static/edumed/js/edumed.coffee index adc3ae56..8b02ae96 100644 --- a/redakcja/static/edumed/js/edumed.coffee +++ b/redakcja/static/edumed/js/edumed.coffee @@ -72,10 +72,14 @@ class Wybor extends Excercise check_question: (question) -> all = 0 good = 0 - solution = @get_value_list(question, 'solution', true) + solution = @get_value_list(question, 'solution') $(".question-piece", question).each (i, qpiece) => - piece_no = parseInt $(qpiece).attr 'data-no' - should_be_checked = solution.indexOf(piece_no) >= 0 + 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 diff --git a/redakcja/static/edumed/js/edumed.js b/redakcja/static/edumed/js/edumed.js index 92ab4c1b..be942174 100644 --- a/redakcja/static/edumed/js/edumed.js +++ b/redakcja/static/edumed/js/edumed.js @@ -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) {