]> git.example.dev Git - binbsis50.git/commitdiff
replaced the best guess time with the mean guess time in the final scoreboard
authorLuigi Pinca <luigipinca@gmail.com>
Sat, 19 May 2012 17:29:09 +0000 (19:29 +0200)
committerLuigi Pinca <luigipinca@gmail.com>
Sat, 19 May 2012 17:29:09 +0000 (19:29 +0200)
lib/room.js
package.json
public/static/js/room.js

index 5ffe82050d61a21adbbf1f31fa3490323a10f2e0..62859e3facee8562caf1fde9ec8694c8ad00d22b 100644 (file)
@@ -48,7 +48,7 @@ module.exports = function(params) {
                                matched: null,
                                guessed: 0,
                                guesstime: null,
-                               bestguesstime: 30000,
+                               totguesstime: 0,
                                golds: 0,
                                silvers: 0,
                                bronzes: 0
@@ -205,9 +205,8 @@ module.exports = function(params) {
                        }
                        usersData[nickname].matched = 'both';
                        usersData[nickname].guessed++;
-                       if (usersData[nickname].guesstime < usersData[nickname].bestguesstime) {
-                               usersData[nickname].bestguesstime = usersData[nickname].guesstime;
-                       }
+                       usersData[nickname].totguesstime += usersData[nickname].guesstime;
+
                        if (usersData[nickname].registered) {
                                stats.userscore = usersData[nickname].points;
                                stats.guesstime = usersData[nickname].guesstime;
@@ -285,7 +284,7 @@ module.exports = function(params) {
                                if (!roundonly) {
                                        usersData[key].points = 0;
                                        usersData[key].guessed = 0;
-                                       usersData[key].bestguesstime = 30000;
+                                       usersData[key].totguesstime = 0;
                                        usersData[key].golds = 0;
                                        usersData[key].silvers = 0;
                                        usersData[key].bronzes = 0;
index 9e62d9883022375ef2fba26c5a3629e0d5309d29..e9c34861f7acebb47625f5a6bd3e167621a67e59 100644 (file)
@@ -18,5 +18,5 @@
   "engines": {
     "node": "0.6.x"
   },
-  "version": "0.3.0-12"
+  "version": "0.3.0-13"
 }
\ No newline at end of file
index d85de8e0168ea65f2bbd84f6a1f4a8205ab014d3..2051455f19ddb45318dfed31c335c8e82db195c9 100644 (file)
                html += '<div class="modal-body"><table class="table table-striped scoreboard">';
                html += '<thead><tr><th>#</th><th>Name</th><th>Points</th>';
                html += '<th><div class="cups stand1"></div></th><th><div class="cups stand2"></div></th>';
-               html += '<th><div class="cups stand3"></div></th><th>Guessed</th><th>Best time</th>';
+               html += '<th><div class="cups stand3"></div></th><th>Guessed</th><th>Mean time</th>';
                html += '</thead><tbody>';
                for(var i=0;i<3;i++) {
                        if (data.users[i]) {
                                html += '<td>'+data.users[i].points+'</td>';
                                html += '<td>'+data.users[i].golds+'</td><td>'+data.users[i].silvers+'</td>';
                                html += '<td>'+data.users[i].bronzes+'</td><td>'+data.users[i].guessed+'</td>';
-                               var besttime = "N/A";
-                               if (data.users[i].bestguesstime !== 30000) {
-                                       besttime = (data.users[i].bestguesstime/1000).toFixed(1)+" s";
+                               var meantime = "N/A";
+                               if (data.users[i].guessed !== 0) {
+                                       meantime = data.users[i].totguesstime / data.users[i].guessed;
+                                       meantime = (meantime / 1000).toFixed(1)+" s";
                                }
-                               html += '<td>'+besttime+'</td></tr>';
+                               html += '<td>'+meantime+'</td></tr>';
                        }
                }
                html +='</tbody></table></div>';