diff options
author | Nicolas BERNSTEIN <alexis211@gmail.com> | 2011-11-20 14:08:33 +0100 |
---|---|---|
committer | Nicolas BERNSTEIN <alexis211@gmail.com> | 2011-11-20 14:08:33 +0100 |
commit | 5d416c64fbf7ec7890f85b4e52d98dddb9746acb (patch) | |
tree | 5ce76600f5db8cf990bae73a7f04817d5f3cdbab /js | |
parent | 3183058847f93b328f153049d0ca8ee9615fac32 (diff) | |
download | Bits-5d416c64fbf7ec7890f85b4e52d98dddb9746acb.tar.gz Bits-5d416c64fbf7ec7890f85b4e52d98dddb9746acb.zip |
Minor changes
Diffstat (limited to 'js')
-rw-r--r-- | js/liststudy.js | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/js/liststudy.js b/js/liststudy.js index a0be379..b33ed6c 100644 --- a/js/liststudy.js +++ b/js/liststudy.js @@ -5,6 +5,9 @@ var items = []; +var max_score = 0; +var med_score = 0; + function show_batch_table() { process_items(); show_contents_table(); @@ -35,6 +38,11 @@ function process_items() { } } } + for (var i = 0; i < items.length; i++) { + if (items[i].score > max_score) max_score = items[i].score; + med_score += items[i].score; + } + med_score = Math.ceil(med_score * 10 / items.length) / 10; } function show_contents_table() { @@ -49,9 +57,12 @@ function show_contents_table() { for (var j = 0; j < items[i].info.length; j++) { html += '<td><span class="cd' + j + '">' + items[i].info[j] + '</span></td>'; } - html += '<td>' + items[i].win + '</td><td>' + items[i].fail + '</td><td>' + items[i].score + '</td></tr>'; + html += '<td>' + items[i].win + '</td>'; + html += '<td' + (items[i].fail > 0 ? (items[i].fail > items[i].win ? ' style="background-color: #ff7777"' : ' style="background-color: #FFFF00"') : '') + '>' + items[i].fail + '</td>'; + html += '<td style="background-color: ' + (items[i].score == max_score ? '#00aa00' : (items[i].score > med_score ? '#55FF55' : '#FFFF00')) + '">' + items[i].score + '</td></tr>'; } html += '</table>'; + html += '<p>Medium score : ' + med_score + '</p>'; $("items").innerHTML = html; } @@ -76,7 +87,7 @@ function show_reviews_table() { for (var i = 0; i < reviews_data.length; i++) { var color = ''; if (reviews_data[i].score == 100) - color = '#00CC00'; + color = '#00aa00'; else if (reviews_data[i].score >= 90) color = '#55FF55'; else if (reviews_data[i].score >= 50) |