check_question: (question) ->
positions = @get_value_list(question, 'original', true)
- sorted = positions.sort()
+ sorted = positions.sort (a, b) -> a - b
pkts = $('.question-piece', question)
correct = 0
return [correct, bad, all]
solve_question: (question) ->
- positions = @get_value_list(question, 'original', true)
- sorted = positions.sort()
pkts = $('.question-piece', question)
- pkts.sort (a, b) ->
- q = $(a).data('pos')
- w = $(b).data('pos')
- return 1 if q < w
- return -1 if q > w
- return 0
-
+ pkts.sort (a, b) -> return $(a).data('pos') - $(b).data('pos')
parent = pkts.eq(0).parent()
for p in pkts
- parent.prepend(p)
+ parent.append(p)
# XXX propozycje="1/0"
-// Generated by CoffeeScript 1.3.3
+// Generated by CoffeeScript 1.4.0
(function() {
var $, Binding, EduModule, Exercise, Luki, PrawdaFalsz, Przyporzadkuj, Uporzadkuj, Wybor, Zastap, exercise,
__hasProp = {}.hasOwnProperty,
Uporzadkuj.prototype.check_question = function(question) {
var all, bad, correct, pkt, pkts, positions, sorted, _i, _ref;
positions = this.get_value_list(question, 'original', true);
- sorted = positions.sort();
+ sorted = positions.sort(function(a, b) {
+ return a - b;
+ });
pkts = $('.question-piece', question);
correct = 0;
bad = 0;
};
Uporzadkuj.prototype.solve_question = function(question) {
- var p, parent, pkts, positions, sorted, _i, _len, _results;
- positions = this.get_value_list(question, 'original', true);
- sorted = positions.sort();
+ var p, parent, pkts, _i, _len, _results;
pkts = $('.question-piece', question);
pkts.sort(function(a, b) {
- var q, w;
- q = $(a).data('pos');
- w = $(b).data('pos');
- if (q < w) {
- return 1;
- }
- if (q > w) {
- return -1;
- }
- return 0;
+ return $(a).data('pos') - $(b).data('pos');
});
parent = pkts.eq(0).parent();
_results = [];
for (_i = 0, _len = pkts.length; _i < _len; _i++) {
p = pkts[_i];
- _results.push(parent.prepend(p));
+ _results.push(parent.append(p));
}
return _results;
};