Quellcode durchsuchen

Added SectorName Query Functionality

Fruit of Eden vor 6 Jahren
Ursprung
Commit
56581898e3
1 geänderte Dateien mit 37 neuen und 23 gelöschten Zeilen
  1. 37 23
      js/common.js

+ 37 - 23
js/common.js

@@ -7,6 +7,8 @@ function load_table_black_rank() {
 
 }
 
+var lastTimeHistory = "";
+
 function history_success(obj, sta) {
     var history = first_parse(this, obj);
     var i, j, t;
@@ -22,44 +24,42 @@ function history_success(obj, sta) {
         t = 0;
     }
 
-    if (t == 2 || t == 3) {
+    if (t === 2 || t === 3) {
         hispass[t] = 0;
         hisfail[t] = 0;
         hisstack[t] = 0;
         hisrate[t] = 0;
-        for (i = 0; i < history.length; i++) {
+        for (i = 0; i < history.length - 1; i++) {
             hispass[t] = history[i].passNum + hispass[t];
             hisfail[t] = history[i].failNum + hisfail[t];
             hisstack[t] = history[i].avgDue + hisstack[t];
         }
-        if (history.length != 1) {
-            if (hispass[t] + hisfail[t] == 0) {
-                hisrate[t] = 0;
-            } else {
-                hisrate[t] = Math.floor(hisfail[t] * 10000 / (hispass[t] + hisfail[t])) / 100;
-            }
+
+        hispass[t] += hispass[0];
+        hisfail[t] += hisfail[0];
+        hisstack[t] += hisstack[0];
+
+        if (hispass[t] + hisfail[t] === 0) {
+            hisrate[t] = 0;
+        } else {
+            hisrate[t] = Math.floor(hisfail[t] * 10000 / (hispass[t] + hisfail[t])) / 100;
         }
-    } else if (t == 1) {
+
+    } else if (t === 1) {
         hispass[1] = history[0].passNum;
         hisfail[1] = history[0].failNum;
         hisstack[1] = history[0].avgDue;
-        if (hispass[1] + hisfail[1] == 0) {
+        if (hispass[1] + hisfail[1] === 0) {
             hisrate[1] = 0;
         } else {
             hisrate[1] = Math.floor(hisfail[1]  * 10000 / (hispass[1] + hisfail[1])) / 100;
         }
     }
-
-    hispass[0] = history[history.length - 1].passNum;
-    hisfail[0] = history[history.length - 1].failNum;
-    hisstack[0] = history[history.length - 1].avgDue;
-    if (hispass[0] + hisfail[0] == 0) {
-        hisrate[0] = 0;
-    } else {
-        hisrate[0] = Math.floor(hisfail[0] * 10000 / (hispass[0] + hisfail[0])) / 100;
-    }
-
+    todayotherpass = history[history.length - 1].passNum;
+    todayotherfail = history[history.length - 1].failNum;
+    todayotherstack = history[history.length - 1].avgDue;
 }
+var todayotherpass , todayotherfail, todayotherstack;
 
 function isUserOfThisFlow(uid) {
     var isExist = false;
@@ -187,6 +187,10 @@ function getSpotHtml2(htmlbody, i) {
 }
 
 
+var lastTimeRank1 = "";
+var lastTimeRank2 = "";
+var lastTimeRank3 = "";
+
 function showEachSpot() {
     var htmlbody = "", one_person = "";
     var i = 0;
@@ -196,11 +200,15 @@ function showEachSpot() {
 
         htmlbody = getSpotHtml(htmlbody, i);
     }
-    $("#rank-one").html(htmlbody);
+    if(lastTimeRank1 !== htmlbody) {
+        $("#rank-one").html(htmlbody);
+        lastTimeRank1 = htmlbody;
+    }
     //console.log(htmlbody);
 }
 
 function showEachSpot1() {
+
     var htmlbody = "", one_person = "";
     var i = 0;
     var triGap = 3;
@@ -209,7 +217,10 @@ function showEachSpot1() {
 
         htmlbody = getSpotHtml1(htmlbody, i);
     }
-    $("#rank-two").html(htmlbody);
+    if(lastTimeRank2 !== htmlbody){
+        $("#rank-two").html(htmlbody);
+        lastTimeRank2 = htmlbody;
+    }
     //console.log(htmlbody);
 }
 
@@ -223,6 +234,9 @@ function showEachSpot2() {
 
         htmlbody = getSpotHtml2(htmlbody, i);
     }
-    $("#rank-three").html(htmlbody);
+    if(lastTimeRank3 !== htmlbody){
+        $("#rank-three").html(htmlbody);
+        lastTimeRank3 = htmlbody;
+    }
     //console.log(htmlbody);
 }