Skip to content

Commit a6fb861

Browse files
committed
#76 show actual nscore
1 parent b1394df commit a6fb861

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

js/health.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,26 @@ function health_node(addr) {
135135

136136
function health_update_nscore() {
137137
var nscore = 0;
138+
var nodes = 0;
138139
$('#health td.nscore').each(function () {
139140
var td = $(this).text();
140141
if (td.match(/^[0-9]+$/)) {
141142
n = parseInt(td);
142143
if (n > nscore) {
143-
nscore = n;
144+
nscore += n;
145+
nodes += 1;
144146
}
145147
}
146148
});
147-
$('#nscore').text(nscore);
149+
nscore = Math.round(nscore / nodes);
150+
var score = 0;
151+
$('#health td.score').each(function () {
152+
var td = $(this).text();
153+
if (td.match(/^[0-9]+$/)) {
154+
score += parseInt(td);
155+
}
156+
});
157+
$('#nscore').html('<span title="average">' + nscore + '</span>/<span title="actual">' + score + '</span>');
148158
}
149159

150160
function health_update_cost() {

0 commit comments

Comments
 (0)