- all_multiple = 0
- for qp in $(".predicate .question-piece", question)
- pred = $(qp).closest("[data-predicate]")
+ if not minimum
+ self = this
+ $(".subject .question-piece", question).each (i, el) ->
+ v = self.get_value_optional_list el, 'solution'
+ mandatory = v[0]
+ all += mandatory.length
+
+ for pred in $(".predicate [data-predicate]", question)
+ pn = $(pred).attr('data-predicate')
+ #if minimum?
+ # all += minimum
+
+ for qp in $(".question-piece", pred)
+ v = @get_value_optional_list qp, 'solution'
+ mandatory = v[0]
+ optional = v[1]
+
+ if mandatory.indexOf(pn) >= 0 or (minimum and optional.indexOf(pn) >= 0)
+ count += 1
+ @piece_correct qp
+ else
+ bad_count += 1
+ @piece_incorrect qp
+
+ return [count, bad_count, all]
+
+ solve_question: (question) ->
+ minimum = $(question).data("min")
+
+ for qp in $(".subject .question-piece", question)