Skip to content

Commit

Permalink
Allow sorting non-float values in comparison table.
Browse files Browse the repository at this point in the history
  • Loading branch information
lo5 committed Jun 13, 2014
1 parent bb125ab commit dd9a506
Showing 1 changed file with 4 additions and 24 deletions.
28 changes: 4 additions & 24 deletions client/src/scripts/scoring-sheet-view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -361,27 +361,6 @@ createMetricInspection = (variables, metric) ->
createThresholdInspection = (variables, metric, index) ->
[ div, h1, h2, table, grid, tbody, tr, th, td ] = geyser.generate words 'div h1 h2 table.table.table-condensed table.table.table-bordered tbody tr th td'

formatConfusionMatrix = (domain, cm) ->
[ d1, d2 ] = domain
[[tn, fp], [fn, tp]] = cm
grid [
tr [
th ''
th d1
th d2
]
tr [
th d1
td tn
td fp
]
tr [
th d2
td fn
td tp
]
]

tabulateProperties = (index) ->
table tbody map variables, (variable) ->
tr [
Expand Down Expand Up @@ -635,9 +614,10 @@ Steam.ScoringSheetView = (_, _scorings) ->
[ span ] = geyser.generate [ "a data-variable-id='$id'" ]

# Sort
_filteredMetrics.sort (a, b) ->
diff = (_sortByVariable.read a) - (_sortByVariable.read b)
if _sortAscending then diff else -diff
_filteredMetrics.sort (metricA, metricB) ->
a = _sortByVariable.read metricA
b = _sortByVariable.read metricB
if _sortAscending then a > b else b > a

header = tr map _filteredMetricVariables, (variable) ->
tag = if variable isnt _sortByVariable then th else if _sortAscending then thAsc else thDesc
Expand Down

0 comments on commit dd9a506

Please sign in to comment.