Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Give me a sort lecture

  • Loading branch information...
commit 5c26b1883bc0884ca69c167943bbbde0afcbf00e 1 parent 83fc498
@alexanderteinum alexanderteinum authored
Showing with 28 additions and 3 deletions.
  1. +15 −2 frontend/views/result.coffee
  2. +13 −1 frontend/views/result.js
View
17 frontend/views/result.coffee
@@ -29,6 +29,13 @@ define ['jquery', 'underscore', 'backbone'], ($, _, Backbone) ->
for test in @options.testRun.get('tests').models
tests.push(@transformResult(test, verifyTests))
+ tests.sort((a, b) ->
+ if a.index > b.index
+ 1
+ else
+ -1
+ )
+
checked = ''
if @shouldHideAutomatedCheckerResults()
checked = 'checked="checked"'
@@ -48,10 +55,16 @@ define ['jquery', 'underscore', 'backbone'], ($, _, Backbone) ->
_answer_auto: @options.locale.translate('result_answer_auto')
}))
transformResult: (result, verifyTests) ->
- if result.get('category') == 'verify'
- index = _.indexOf(verifyTests, result)
+ index = _.indexOf(verifyTests, result)
+
+ if result.get('category') is 'verify'
if index isnt -1
result.set 'testTitle', '<a href="' + window.location.href.split('#')[0] + '#test/' + index + '">' + result.get('testTitle') + '</a>'
+ result.set 'index', index
+ else
+ result.set 'index', 5000
+ else
+ result.set 'index', 10000
if result.get('line') is 0
result.set 'line', ''
View
14 frontend/views/result.js
@@ -38,6 +38,13 @@
test = _ref[_i];
tests.push(this.transformResult(test, verifyTests));
}
+ tests.sort(function(a, b) {
+ if (a.index > b.index) {
+ return 1;
+ } else {
+ return -1;
+ }
+ });
checked = '';
if (this.shouldHideAutomatedCheckerResults()) {
checked = 'checked="checked"';
@@ -61,11 +68,16 @@
transformResult: function(result, verifyTests) {
var index;
+ index = _.indexOf(verifyTests, result);
if (result.get('category') === 'verify') {
- index = _.indexOf(verifyTests, result);
if (index !== -1) {
result.set('testTitle', '<a href="' + window.location.href.split('#')[0] + '#test/' + index + '">' + result.get('testTitle') + '</a>');
+ result.set('index', index);
+ } else {
+ result.set('index', 5000);
}
+ } else {
+ result.set('index', 10000);
}
if (result.get('line') === 0) {
result.set('line', '');
Please sign in to comment.
Something went wrong with that request. Please try again.