fnp
/
redakcja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Revert "Edit <opis>"
[redakcja.git]
/
redakcja
/
static
/
edumed
/
js
/
edumed.coffee
diff --git
a/redakcja/static/edumed/js/edumed.coffee
b/redakcja/static/edumed/js/edumed.coffee
index
84fb91f
..
8b02ae9
100644
(file)
--- a/
redakcja/static/edumed/js/edumed.coffee
+++ b/
redakcja/static/edumed/js/edumed.coffee
@@
-44,7
+44,7
@@
class Excercise extends Binding
@show_score(score)
get_value_list: (elem, data_key, numbers) ->
@show_score(score)
get_value_list: (elem, data_key, numbers) ->
- vl = $(elem).
data(
data_key).split(/[ ,]+/).map($.trim) #.map((x) -> parseInt(x))
+ vl = $(elem).
attr("data-" +
data_key).split(/[ ,]+/).map($.trim) #.map((x) -> parseInt(x))
if numbers
vl = vl.map((x) -> parseInt(x))
return vl
if numbers
vl = vl.map((x) -> parseInt(x))
return vl
@@
-72,10
+72,14
@@
class Wybor extends Excercise
check_question: (question) ->
all = 0
good = 0
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) =>
$(".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
is_checked = $("input", qpiece).is(":checked")
if should_be_checked