Skip to content

Commit

Permalink
Merge pull request #135 from EdinburghGenomics/coloring_side_effect
Browse files Browse the repository at this point in the history
Fix side effect of overwriting the format from one row to the next
  • Loading branch information
Timothee Cezard authored Nov 8, 2017
2 parents b98da45 + ad77c9c commit 5e0bc8d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions reporting_app/static/column_formatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,18 @@ function string_formatter(data, fmt, row){
formatted_data = '<a href=' + fmt['link'] + data + '>' + data + '</a>';
}
}
var min, max;
if (fmt['min']){
fmt['min'] = resolve_min_max_value(row, fmt['min'])
min = resolve_min_max_value(row, fmt['min'])
}
if (fmt['max']){
fmt['max'] = resolve_min_max_value(row, fmt['max'])
max = resolve_min_max_value(row, fmt['max'])
}
if (fmt['min'] && data < fmt['min']) {
if (min && data < min) {
formatted_data = '<div style="color:red">' + formatted_data + '</div>';
} else if (fmt['max'] && !isNaN(fmt['max']) && data > fmt['max']) {
} else if (max && !isNaN(max) && data > max) {
formatted_data = '<div style="color:red">' + formatted_data + '</div>';
} else if (fmt['max'] && data > fmt['max']) {
} else if (max && data > max) {
formatted_data = '<div style="color:red">' + formatted_data + '</div>';
}

Expand Down

0 comments on commit 5e0bc8d

Please sign in to comment.