$(".check", @element).click (ev) =>
@check()
- $(ev.target).next(".retry").show()
- $(ev.target).hide()
+ $(".retry", @element).show()
+ $(".check", @element).hide()
$(".retry", @element).click (ev) =>
@retry()
$('.solutions', @element).click =>
return [mandat, opt]
show_score: (score) ->
- $(".message", @element).text("Wynik: #{score[0]} / #{score[1]}")
+ $msg = $(".message", @element)
+ $msg.text("Wynik: #{score[0]} / #{score[1]}")
+ if score[0] == score[1]
+ $msg.addClass("maxscore")
+ else
+ $msg.removeClass("maxscore")
draggable_equal: ($draggable1, $draggable2) ->
@dragging false, false
check: ->
- all = 0
+ all = $(".placeholder", @element).length
correct = 0
$(".placeholder + .question-piece", @element).each (i, qpiece) =>
$placeholder = $(qpiece).prev(".placeholder")
correct += 1
else
@piece_incorrect qpiece
- all += 1
@show_score [correct, all]
class Przyporzadkuj extends Exercise
is_multiple: ->
for qp in $(".question-piece", @element)
- if $(qp).data('solution').split(/[ ,]+/).length > 1
+ if $(qp).attr('data-solution').split(/[ ,]+/).length > 1
return true
return false
count = 0
all = 0
if not minimum
- all = $(".subjects .question-piece", question).length
+ all = $(".subject .question-piece", question).length
for pred in $(".predicate [data-predicate]", question)
pn = $(pred).attr('data-predicate')
for m in draggables
$pr = $(".predicate [data-predicate=" + m + "]", question)
$ph = $pr.find ".placeholder:visible"
- @draggable_move $(qp), $ph, @multiple
+ @draggable_move $(qp), $ph.eq(0), @multiple
super element
for qp in $(".question-piece", @element)
- $(".true", qp).click (ev) ->
+ $(".true", qp).click (ev) =>
ev.preventDefault()
@retry()
- $(this).closest(".question-piece").data("value", "true")
- $(this).addClass('chosen').siblings('a').removeClass('chosen')
- $(".false", qp).click (ev) ->
+ $(ev.target).closest(".question-piece").data("value", "true")
+ $(ev.target).addClass('chosen').siblings('a').removeClass('chosen')
+ $(".false", qp).click (ev) =>
ev.preventDefault()
@retry()
- $(this).closest(".question-piece").data("value", "false")
- $(this).addClass('chosen').siblings('a').removeClass('chosen')
+ $(ev.target).closest(".question-piece").data("value", "false")
+ $(ev.target).addClass('chosen').siblings('a').removeClass('chosen')
check_question: ->