function load_table_red_rank() { get_data("fcBiWorkerDaily/get?type=0&limit=3", on_red_rank_success); } function load_table_black_rank() { get_data("fcBiWorkerDaily/get?type=4&limit=3", on_black_rank_success); } var lastTimeHistory = ""; function history_success(obj, sta) { var history = first_parse(this, obj); var i, j, t; console.log(" history : "); console.log(history); if (this.url.indexOf("type=1") >= 0) { t = 1; } else if (this.url.indexOf("type=2") >= 0) { t = 2; } else if (this.url.indexOf("type=3") >= 0) { t = 3; } else { t = 0; } if (t === 2 || t === 3) { hispass[t] = 0; hisfail[t] = 0; hisstack[t] = 0; hisrate[t] = 0; 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]; } 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) { hispass[1] = history[0].passNum; hisfail[1] = history[0].failNum; hisstack[1] = history[0].avgDue; if (hispass[1] + hisfail[1] === 0) { hisrate[1] = 0; } else { hisrate[1] = Math.floor(hisfail[1] * 10000 / (hispass[1] + hisfail[1])) / 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; userIDs.forEach(function (vals) { if (vals == uid) { isExist = true; } }); return isExist; } function on_red_rank_success(obj, sta) { var redchart = first_parse(this, obj); var i, j; i = j = 0; console.log(" redchart : "); console.log(redchart); for (i = 0; i < redchart.list.length; i++) { goodid[i] = getUserName(redchart.list[i].workerId); goodpass[i] = redchart.list[i].passNum; if(redchart.list[i].passNum + redchart.list[i].failNum > 0) { goodfailrate[i] = Math.floor(redchart.list[i].failNum * 10000 / (redchart.list[i].passNum + redchart.list[i].failNum)) / 100; }else{ goodfailrate[i] = 0; } if(isUserOfThisFlow(redchart.list[i].workerId)){ goodColor[i] = 'red'; }else{ goodColor[i] = ''; } } } function on_black_rank_success(obj, sta) { var blackchart = first_parse(this, obj); var i, j; i = j = 0; console.log(" black chart : "); console.log(blackchart); for (i = 0; i < blackchart.list.length; i++) { badid[i] = getUserName(blackchart.list[i].workerId); badpass[i] = blackchart.list[i].passNum; //badfailrate[i] = blackchart.list[i].failRate / 100; if(blackchart.list[i].passNum + blackchart.list[i].failNum > 0) { badfailrate[i] = Math.floor(blackchart.list[i].failNum * 10000 / (blackchart.list[i].passNum + blackchart.list[i].failNum)) / 100; }else{ badfailrate[i] = 0; } if(isUserOfThisFlow(blackchart.list[i].workerId)){ badColor[i] = 'green'; }else{ badColor[i] = ''; } } } function getSpotHtml(htmlbody, i) { if(typeof hispass[i] === "undefined"){ htmlbody += "