+class Przyporzadkuj extends Excercise
+ is_multiple: ->
+ for qp in $(".question-piece", @element)
+ if $(qp).data('solution').split(/[ ,]+/).length > 1
+ return true
+ return false
+
+ constructor: (element) ->
+ super element
+
+ @multiple = @is_multiple()
+
+ @dragging @multiple, true
+
+ draggable_equal: (d1, d2) ->
+ return d1.data("no") == d2.data("no")
+
+
+ check_question: (question) ->
+ # subjects placed in predicates
+ count = 0
+ all = 0
+ all_multiple = 0
+ for qp in $(".predicate .question-piece", question)
+ pred = $(qp).closest("[data-predicate]")
+ v = @get_value_optional_list qp, 'solution'
+ mandatory = v[0]
+ optional = v[1]
+ all_multiple += mandatory.length + optional.length
+ pn = pred.data('predicate')
+ if mandatory.indexOf(pn) >= 0 or optional.indexOf(pn) >= 0
+ count += 1
+ @piece_correct qp
+ else
+ @piece_incorrect qp
+ all += 1
+
+ if @multiple
+ for qp in $(".subject .question-piece", question)
+ v = @get_value_optional_list qp, 'solution'
+ mandatory = v[0]
+ optional = v[1]
+ all_multiple += mandatory.length + optional.length
+ return [count, all_multiple]
+ else
+ return [count, all]
+
+
+class PrawdaFalsz extends Excercise
+ constructor: (element) ->
+ super element
+
+ for qp in $(".question-piece", @element)
+ $(".true", qp).click (ev) ->
+ ev.preventDefault()
+ $(this).closest(".question-piece").data("value", "true")
+ $(this).addClass('chosen').siblings('a').removeClass('chosen')
+ $(".false", qp).click (ev) ->
+ ev.preventDefault()
+ $(this).closest(".question-piece").data("value", "false")
+ $(this).addClass('chosen').siblings('a').removeClass('chosen')
+
+
+ check_question: ->
+ all = 0
+ good = 0
+ for qp in $(".question-piece", @element)
+ if $(qp).data("solution").toString() == $(qp).data("value")
+ good += 1
+ @piece_correct qp
+ else
+ @piece_incorrect qp
+
+ all += 1
+
+ return [good, all]