X-Git-Url: https://git.mdrn.pl/edumed.git/blobdiff_plain/ee9eaab760964d7a27aefdaf9c9ee5379f680994..068d95bd6f8b28031a9e5236dbec460aad44ae7a:/wtem/static/wtem/edumed.coffee diff --git a/wtem/static/wtem/edumed.coffee b/wtem/static/wtem/edumed.coffee index baae08e..f4c5c28 100644 --- a/wtem/static/wtem/edumed.coffee +++ b/wtem/static/wtem/edumed.coffee @@ -297,6 +297,12 @@ class Uporzadkuj extends Exercise for p in pkts parent.prepend(p) + get_answer: (question) -> + answer = [] + $(".question-piece", @element).each (i, qpiece) => + answer.push($(qpiece).attr('data-pos')) + return answer + # XXX propozycje="1/0" class Luki extends Exercise @@ -459,6 +465,15 @@ class Przyporzadkuj extends Exercise $ph = $pr.find ".placeholder:visible" @draggable_move $(qp), $ph.eq(0), @multiple + get_answer: (question) -> + answer = {} + $(".predicate [data-predicate]", question).each (i, subjects) => + predicate = $(subjects).attr('data-predicate') + answer[predicate] = [] + $('.question-piece', subjects).each (i, qpiece) => + $qpiece = $(qpiece) + answer[predicate].push($qpiece.attr('data-id')) + return answer class PrawdaFalsz extends Exercise @@ -502,6 +517,11 @@ class PrawdaFalsz extends Exercise else $(".false", qp).click() + get_answer: (question) -> + answer = [] + $(".question-piece", @element).each (i, qpiece) => + answer.push($(qpiece).data('value') || '-') + return answer ##########