summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas BERNSTEIN <alexis211@gmail.com>2011-11-20 14:08:33 +0100
committerNicolas BERNSTEIN <alexis211@gmail.com>2011-11-20 14:08:33 +0100
commit5d416c64fbf7ec7890f85b4e52d98dddb9746acb (patch)
tree5ce76600f5db8cf990bae73a7f04817d5f3cdbab
parent3183058847f93b328f153049d0ca8ee9615fac32 (diff)
downloadBits-5d416c64fbf7ec7890f85b4e52d98dddb9746acb.tar.gz
Bits-5d416c64fbf7ec7890f85b4e52d98dddb9746acb.zip
Minor changes
-rw-r--r--js/liststudy.js15
-rw-r--r--tpl/study/list.php2
2 files changed, 14 insertions, 3 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)
diff --git a/tpl/study/list.php b/tpl/study/list.php
index feffc72..0d04ccb 100644
--- a/tpl/study/list.php
+++ b/tpl/study/list.php
@@ -12,7 +12,7 @@ foreach ($batches as $batch) {
$color = "";
if ($batch['lr_date']) {
if ($batch['lr_score'] == 100)
- $color = "#00CC00";
+ $color = "#00AA00";
else if ($batch['lr_score'] >= 90)
$color = "#55FF55";
else if ($batch['lr_score'] >= 50)